IF ... THEN ... ELSE ... ENDIF |
IF Condition THEN
statement(s)
{ ELSE
statement(s) }
ENDIF
Function
Evaluate Condition and, if it is true, run the code block that follows
THEN, otherwise jump to the (optional) code block that follows ELSE.
If no ELSE block is provided, the program will continue at the line that
follows ENDIF.
Explanation
IF...THEN...ELSE is a primary decision maker that allows one block of code
or [optionally] another to run based on the result (True or False) of a condition.
The available comparison operators are:
Comparison Operator | Definition |
= | Equal |
<> | Not Equal |
> | Greater Than |
< | Less Than |
>= | Greater Than or Equal To |
<= | Less Than or Equal To |
Comparisons are always written in the form: Variable Op Value.
This simple example shows how IF...THEN...ELSE is used with a subroutine that can accept one or two parameters.
' Use: DELAY milliseconds {, multiplier} ' -- pause for milliseconds x (optional) multiplier DELAY: temp1 = __PARAM1 IF __PARAMCNT = 1 THEN ' if only base time temp2 = 1 ' set multiplier to 1 ELSE temp2 = __PARAM2 ' else use multiplier ENDIF IF temp1 > 0 THEN IF temp2 > 0 PAUSE temp1 * temp2 ENDIF ENDIF RETURN
Related instruction: IF...THEN
file: /Techref/parallax/sxb/sxb/if-then-else.htm, 3KB, , updated: 2006/4/10 14:47, local time: 2025/5/23 07:15,
216.73.216.208,10-1-20-228:LOG IN
|
©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/parallax/sxb/sxb/if-then-else.htm"> IF-THEN-ELSE</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.