- Name:
- endif
- Syntax:
-
IF condition THEN
{code}
ELSEIF condition THEN
{code}
ELSE
{code}
ENDIFCondition - The condition which will cause the associated code commands to be executed or not.
Code - Command statements which will be executed dependant upon the evaluation of the condition.
- Description:
-
The endif command is used to terminate a multiple line if command. The command can either be specified as a single word, 'endif' or as two separate words, 'end if'.
For more detailed information and further examples, please see the if command page.
Flash an LED when a button is pressed
Continually check C.0 to see if it is high - if it is, turn B.1 on for 5 seconds
- Code Example:
-
main: if pinC.0 = 1 then goto flsh ; jump to flsh if pin0 is high else goto main ; else loop back to start endif flsh: high B.1 ; switch on output B.1 pause 5000 ; wait 5 seconds low B.1 ; switch off output B.1 goto main ; loop back to start
Copy Code Submit an Example
Submit Your Own Code!
You must be logged in to submit code examples. Login now.