Difference between revisions of "Greatern"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''greatern''' command compares a variable value to a number. It returns TRUE if the value of the variable is greater than the number. == Syntax == greatern(variab...")
 
 
Line 20: Line 20:
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="agi">
 
<syntaxhighlight lang="agi">
if(greatern(v50, 75)) {
+
if(greatern(v50, 75))
    print("v50 is greater than 75");
+
  {
}
+
  print("v50 is greater than 75");
if(v50 > 75) { [ alternate syntax
+
  }
    print("v50 is greater than 75");
+
 
}
+
if(v50 > 75)  [ alternate syntax
if(v50 <= 75) { [ equivalent to 'if(!greatern(v50, v51)) {'
+
  {
 +
  print("v50 is greater than 75");
 +
  }  
 +
 
 +
if(v50 <= 75)  [ equivalent to 'if(!greatern(v50, v51))'
 +
  {
 
   print ("v50 is less than or equal to 75");
 
   print ("v50 is less than or equal to 75");
}
+
  }
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 11:57, 14 April 2019

The greatern command compares a variable value to a number. It returns TRUE if the value of the variable is greater than the number.

Syntax

greatern(var vA, byt B)
vA > B

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(greatern(v50, 75))

 {
 print("v50 is greater than 75");
 }

if(v50 > 75) [ alternate syntax

 {
 print("v50 is greater than 75");
 } 

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

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

</syntaxhighlight>

Technical Information

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

See Also

Test Commands
greaterv