1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 17:55:52 +00:00
QB64-PE/internal/help/ELSEIF.txt
SMcNeill 6e01fc8dce Altered string compare routines (<,<=,>,>=) so they don't give false results with CHR$(0).
Added new _STRCMP and _STRICMP commands for quick string comparisons.
Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders.
Altered UCASE and LCASE routines to be faster in some situations for us.
2014-09-22 08:19:03 -04:00

52 lines
1.3 KiB
Plaintext

'''ELSEIF''' is used in a block [[IF...THEN]] statement to offer an alternative condition.
''Block'' {{PageSyntax}}
:: IF condition &gt; 0 THEN
:: evaluation = -1
:: [[ELSEIF]] condition &lt; 0 THEN evaluation = -1
:: [[ELSE]] evaluation = 0
:: [[END IF]]
* ELSEIF statements REQUIRE a '''separate''' code block line with [[THEN]] for each alternative condition.
* There can be more than one [[ELSE]] IF statement in a single-line IF statement.
* If there is only ONE possible alternative condition(such as 0 or [[NOT]] 0), then use [[ELSE]] instead.
* If the comparisons are based on multiple conditions being true, it may require many ELSEIF comparisons. ELSE could help cover some of those conditions.
* You can use [[SELECT CASE]] when IF blocks have a long list of alterative ELSEIF conditions.
{{Template:RelationalTable}}
''Example 1:'' IF statement using ELSE IF in one statement line.
{{CodeStart}}
IF x = 100 THEN COLOR 10: PRINT x ELSE IF x &gt; 100 THEN COLOR 12: PRINT x ELSE PRINT &quot;&lt; 100&quot;
{{CodeEnd}}
''Example 2:'' IF statement block
{{CodeStart}}
IF x = 100 THEN ' must place ANY code on next line!
COLOR 10: PRINT x
ELSEIF x &gt; 100 THEN COLOR 12: PRINT x
ELSE : PRINT &quot;&lt; 100&quot;
END IF
{{CodeEnd}}
''See also:''
*[[ELSE]], [[END IF]]
*[[IF...THEN]]
{{PageNavigation}}