IFF


Language function IFF


10
20  IFF expr
30
Inline version of IF. eg, animal = “cat”: fur = IFF: ? fur


See examples


If there is insufficient information on this page and you wish learn more about IFF, please send an email to smallbasic@gmail.com. You can help to improve information about IFF by submitting an article using the comments link below. Note, an offline language reference text file is now avialable – see the Download section.

Comments

animal=IFF(HasFur=1,"Cat","Fish")
or
? IFF(animal="cat"," has fur.", " might not have fur.")
?

' RND - returns a number from 0 to almost 1

' IFF - IFF(conditional statement to evaluate, return this if evaluates true, returns this if evaluates false)

FOR i=1 TO 20 'need a random true/false, subst 0 or 1 (or -1)  ;)
  ? IFF(rnd<.5,"True ","False ");   '<======================== RND and IFF
next
?:?

FOR i=1 TO 10  'need a random direction back and forth
  dir=IFF(RND<.5,-360*RND,360*RND)  '<======================== RND and IFF
  ? USING " ####.0000"; dir;
NEXT
?:?
PAUSE