IF: Difference between revisions

From Macros Wiki
Jump to navigationJump to search
MikeO (talk | contribs)
No edit summary
ConnerO (talk | contribs)
No edit summary
Line 25: Line 25:
<br>
<br>
:The message "Hello" will be displayed (because 3 is less than 4), but the message "Goodbye" will not be displayed (because 3 is not eual to 4).
:The message "Hello" will be displayed (because 3 is less than 4), but the message "Goodbye" will not be displayed (because 3 is not eual to 4).
:For an example in a real macro see [[Modify_op_path]]






[[Category:Language]]
[[Category:Language]]

Revision as of 18:05, 27 July 2010

Command

IF <value 1> <condition> <value 2>, THEN


Conditional check to compare two values and act upon the result.

Parameters

<value 1>
First value to check
<condition>
Type of check, must be on of the following 6
= Equals
<> Not equal
< Less than
> Greater than
<= Less than or equal
>= Greater than or equal
<value 2>
Second value to check
THEN
The second value must be followed by THEN
Any macro command can follow THEN. This command will be executed if the check if true

Example

A1 = 3
A2 = 4
IF A1 < A2 THEN Message "Hello"
IF A1 = A2 THEN Message "Goodbye"


The message "Hello" will be displayed (because 3 is less than 4), but the message "Goodbye" will not be displayed (because 3 is not eual to 4).


For an example in a real macro see Modify_op_path