home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH10LIST C:\UT2004"
- //Identifies the package
- //CH10_02LIST.uc
-
- class CH10_02LIST extends Commandlet;
-
- function int Main(string Args)
- {
- //#1
- local int iIntegerNum;
- local byte bByteNum;
- local float rRealNum;
- local bool fFlag;
- local string szNationA, szNationB;
-
- iIntegerNum = 18;
- bByteNum = 25;
- rRealNum = 35.15;
- fFlag = true;
- szNationA = "China";
- szNationB = "India";
-
-
- log("*************");
- log("CH10_02LIST Relation and negation" $ chr(13) $ "");
- log(chr(13));
-
-
- //#2 you can compare integers, floats, and bytes
-
- if(iIntegerNum < bByteNum){
- log(" iIntegerNum is less than bByteNum.");
- }
-
- if(bByteNum >= iIntegerNum){
- log(" bByteNum is greater than iIntegerNum.");
- }
-
- if(rRealNum != iIntegerNum){
- log(" rRealNum is not equal to iIntegerNum.");
- }
-
- //# 3 you can use the negation operator with bools
- // Other numbers generate an error
- if(fFlag){
- log(" fFlag is true.");
- }
-
- //fFlag is still true, but you use ! to negate it
- if(!fFlag == false){
- log(" fFlag is true but negated.");
- }
-
- //#4 string operations
- if("China" == szNationA){
- log(" China is the same as" @ szNationA);
- }
-
- if("china" ~= "China"){
- log(" china is the same as" @ szNationA);
- }
-
- if(szNationA != szNationB){
- log("" @ szNationA @ "is different from " @ szNationB);
- }
-
- return 0;
-
- }
-