Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
ifthenelse [2019/07/15 10:16] neilsifthenelse [2019/07/15 10:17] (current) neils
Line 27: Line 27:
   
 Please refer to the [[operators|Operators]] page for the list of supported operators. Please refer to the [[operators|Operators]] page for the list of supported operators.
- 
-Since version 1.2, multiple statements can be written in one line using the statement separator character ('':''). This, in combination with the line concatenation character allows you to write multi-line ''IF ... THEN'' blocks: 
- 
- if x = y then ~ 
- print "the numbers are equal" : ~ 
- print "whatever else here" : ~ 
- eq = 1 ~ 
- else ~ 
- print "the numbers are not equal" : ~ 
- eq = 0 
-  
-The above is technically a single line in **XC=BASIC**. 
- 
-Note that no other characters are allowed after the ''~'', not even a whitespace! 
  
 ====== Performance tip ====== ====== Performance tip ======
  
 An ''ON ... GOTO'' or ''ON ... GOSUB'' construct is faster than its ''IF ... THEN GOTO/GOSUB'' equivalent. Please refer to the [[ON|ON construct]] for details. An ''ON ... GOTO'' or ''ON ... GOSUB'' construct is faster than its ''IF ... THEN GOTO/GOSUB'' equivalent. Please refer to the [[ON|ON construct]] for details.