CHOICE()

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

Syntax:
CHOICE(condition, ExpressionIfTrue, ExpressionIfFalse)

Description:

This function allows you to do simple either/or selections more efficiently and faster than using IF THEN ELSE ENDIF clauses
The condition is anything that will resolve to nonzero (true) or zero (false)
The expressions are anything that you could normally assign to a variable or use in a command and can be integers, floats or strings
e.g.
print choice(1, "hello","bye") will print "Hello"
print choice(0, "hello","bye") will print "Bye"
a=1:b=1:print choice(a=b, 4,5) will print 4

 ' new method
 DO
   INPUT x
   answer$ = CHOICE(x>5,"High","Low")
   PRINT answer$
 LOOP
 
 ' old method
 DO
   INPUT x
   IF x > 5 THEN
     answer$ = "High"
   ELSE
     answer$ = "Low"
   ENDIF
   PRINT answer$
 LOOP
 

Last edited: 25 February, 2021