IIF

Instant IF functions by the model it exists in FoxPro and VB iif(test, valYes, valNo) Because JB has different string type, it accompanied with function iif$(test, valYes$, valNo$)

It seems to be very useful as it allows include yes/no logic in the expressions.

code format="thinbasic" 'example: print iif(2>3, 10,20)      'Numeric result. Check fails - Prints 20 print iif$(2<3, "10","20") 'String results. Check holds - Prints 10 'some more examples x = rnd(1)-0.5 y = sqr(iif(x>0,x,0))      'in the expression we restrict argument to be >=0 print x, y   print "X is ";iif$(x>=0, "positive","negative")

' function iif(test, valYes, valNo) iif = valNo if test then iif = valYes end function

function iif$(test, valYes$, valNo$) iif$ = valNo$ if test then iif$ = valYes$ end function code