Difference between revisions of "Lessv"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''lessv''' command compares the values of two variables. It returns TRUE if the value of the first variable is less than the value of the second variable. =...")
 
 
Line 30: Line 30:
 
   }
 
   }
  
if(v50 >= v51) [ equivalent to 'if(!lessv(v50, v51)) {'
+
if(v50 >= v51) [ equivalent to 'if(!lessv(v50, v51))'
 
   {
 
   {
 
   print ("v50 is greater than or equal to v51");
 
   print ("v50 is greater than or equal to v51");

Latest revision as of 12:09, 14 April 2019

The lessv command compares the values of two variables. It returns TRUE if the value of the first variable is less than the value of the second variable.

Syntax

lessv(var vA, var vB)
vA < vB

Remarks

Test commands are only valid in an if statement.

This statement can be combined with the NOT operator to create a ‘greater than or equal to’ test.

Possible Errors

None.

Example

Code:

<syntaxhighlight lang="agi"> if(lessv(v50, v51))

 {
 print("v50 is less than v51");
 }

if(v50 < v51) [ alternate syntax

 {
 print("v50 is less than v51");
 }

if(v50 >= v51) [ equivalent to 'if(!lessv(v50, v51))'

 {
 print ("v50 is greater than or equal to v51");
 }

</syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 4 (0x04 hex)

See Also

Test Commands
lessn