1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 16:45:53 +00:00
QB64-PE/internal/help/ELSE.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

54 lines
1.3 KiB
Plaintext

'''ELSE''' is used in [[IF...THEN]] or [[SELECT CASE]] statements to offer an alternative to other conditional statements.
{{PageSyntax}}
:: IF condition &lt;&gt; 0 THEN evaluation = -1 [[ELSE]] evaluation = 0
''Block {{PageSyntax}}
:: IF condition &gt; 0 THEN
:: evaluation = -1
:: [[ELSEIF]] condition &lt; 0 THEN evaluation = -1
:: [[ELSE]] evaluation = 0
:: [[END IF]]
* ELSE is used in a IF block statement to cover any remaining conditions not covered in the block by IF or [[ELSEIF]].
* [[CASE ELSE]] covers any remaining conditions not covered by the other CASE statements.
* ELSE can also be used as a False comparison to a True IF statement when a condition will only be True or False.
* Other [[IF...THEN]] statements can be inside of an ELSE statement.
''Example 1:'' One line IF statement
{{CodeStart}}
IF x = 100 THEN PRINT &quot;100&quot; ELSE PRINT &quot;Not 100&quot;
{{CodeEnd}}
''Example 2:'' Multiple line IF statement block
{{CodeStart}}
IF x = 100 THEN ' code executed MUST be on next statement line!
PRINT &quot;100&quot;
ELSE PRINT &quot;Not 100&quot;
END IF
{{CodeEnd}}
''Example 3:'' To alternate between any two values (as long as the value after ELSE is the same as the condition)
{{CodeStart}}
IF a = 3 THEN a = 5 ELSE a = 3
{{CodeEnd}}
''See also:''
* [[ELSEIF]]
* [[IF...THEN]]
{{PageNavigation}}