home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH14LIST C:\UT2004"
- //Identifies the package
- //CH14_01LIST.uc
-
- class CH14_02LIST extends Commandlet;
- function int Main(string Args){
- //#1
- //Control, Limit, and Counter
- local Array<string> rgMinerals;
- local string szMinerals;
- local int iLIMIT, iCtr;
-
- iCtr = 0;
- szMinerals = "Covelite Galena Stibinite " $
- "Molybdenite Graphite Pyrolusite Basalt";
- iLIMIT = Split(szMinerals, Chr(32) , rgMinerals);
-
- Log(Chr(10) @ "CH14_02LIST" @ Chr(10));
-
- Log(" Number of items: " @ iLIMIT);
- //The number of items in the array is 7, but
- //the indexes start at zero, so you get
- //an error if you start at 7; start at six
- //use iLIMIT -1
-
- //#2
- Log(" List 1 (iCtr--):");
- for(iCtr = iLIMIT-1; iCtr >= 0 ; iCtr--){
- Log(" " $iCtr $ ". " $ rgMinerals[iCtr] );
- }
- //#3
- Log(" List 3 Alternative count by -= 2:" );
- for(iCtr = iLIMIT-1; iCtr >= 0 ; iCtr -= 2){
- Log(" " $iCtr $ ". " $ rgMinerals[iCtr] );
- }
- //#4
- Log(" List 3 Alternative count by += 3:" );
- for(iCtr = 0; iCtr < iLIMIT ; iCtr += 3){
- Log(" " $iCtr $ ". " $ rgMinerals[iCtr] );
- }
- //#5
- Log(" List 3 Alternative count by Rand(3):" );
- for(iCtr = 0; iCtr < iLIMIT ; iCtr += Rand(3) ){
- Log(" " $iCtr $ ". " $ rgMinerals[iCtr] );
- }
- return 0;
- }
-
-
-