Greaterv

From AGI Wiki
Revision as of 12:01, 14 April 2019 by Andrew Korson (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Syntax

greaterv(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 ‘less than or equal to’ test.

Possible Errors

None.

Example

Code:

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

 {
 print("v50 is greater than v51");
 }
if(v50 > v51)  [  alternate syntax 
 {
 print("v50 is greater than v51");
 }

if(v50 <= v51) [ equivalent to 'if(!greaterv(v50, v51))'

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

</syntaxhighlight>

Technical Information

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

See Also

Test Commands
greatern