home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh10 / CH10LIST / Classes / CH10_02LIST.uc < prev    next >
Encoding:
Text File  |  2006-01-31  |  1.4 KB  |  70 lines

  1. // %PARAMETERS = "CH10LIST C:\UT2004"
  2. //Identifies the package
  3. //CH10_02LIST.uc
  4.  
  5. class CH10_02LIST extends Commandlet;
  6.  
  7. function int Main(string Args)
  8. {
  9.   //#1
  10.   local int iIntegerNum;
  11.   local byte bByteNum;
  12.   local float rRealNum;
  13.   local bool fFlag;
  14.   local string szNationA, szNationB;
  15.  
  16.   iIntegerNum = 18;
  17.   bByteNum  = 25;
  18.   rRealNum   = 35.15;
  19.   fFlag = true;
  20.   szNationA = "China";
  21.   szNationB = "India";
  22.  
  23.  
  24.   log("*************");
  25.   log("CH10_02LIST Relation and negation" $ chr(13) $ "");
  26.   log(chr(13));
  27.   
  28.  
  29.   //#2 you can compare integers, floats, and bytes
  30.  
  31.   if(iIntegerNum < bByteNum){
  32.      log(" iIntegerNum is less than bByteNum.");
  33.   }
  34.  
  35.   if(bByteNum >= iIntegerNum){
  36.       log(" bByteNum is greater than iIntegerNum.");
  37.   }
  38.  
  39.   if(rRealNum != iIntegerNum){
  40.      log(" rRealNum is not equal to iIntegerNum.");
  41.   }
  42.  
  43.   //# 3 you can use the negation operator with bools
  44.   // Other numbers generate an error
  45.   if(fFlag){
  46.      log(" fFlag is true.");
  47.   }
  48.  
  49.   //fFlag is still true, but you use ! to negate it
  50.   if(!fFlag == false){
  51.      log(" fFlag is true but negated.");
  52.   }
  53.  
  54.   //#4 string operations
  55.   if("China" == szNationA){
  56.   log(" China is the same as"  @ szNationA);
  57.   }
  58.  
  59.   if("china" ~= "China"){
  60.      log(" china is the same as"  @ szNationA);
  61.   }
  62.  
  63.   if(szNationA != szNationB){
  64.       log("" @ szNationA @ "is different from "  @ szNationB);
  65.   }
  66.  
  67.   return 0;
  68.  
  69. }
  70.