These commands implement a multiple conditional jump. It is a question
of verifying whether a given expression, supplied as first, is equal
to the various expressions that will be gradually registered through
the CASE
statement. If they are, the code following the CASE statement
will be executed. Otherwise, we will move on.
If the CASE ELSE
statement is given, it will be executed if there is no
other match. It follows that it must be placed last.
The code executed is always and only the one between the CASE
that satisfies
the condition and the next one (or the CASE ELSE
). The code on CASE ELSE
will be execute always and only if other matches fail.
SELECT CASE [expression] : CASE [match1] : ... {: CASE [match2] : ... } { : CASE ELSE : .... } : ENDSELECT
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
SELECT CASE...CASE...CASE ELSE...ENDSELECT ↔ SlCs...Cs...CsEl...Es
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS