[Gambas-user] Feature Request

Ian ian.roper at ...1974...
Sat Feb 7 02:51:34 CET 2015


Would it be possible to have a Gambas function to return a string based 
on a Boolean value.
IFF may not be the best naming convention for the keyword but was all I 
could think of.

Public Function IFF(InBool As Boolean, InStrTrue As String, InStrFalse 
As String) As String

    If Inbool Then
       Return InStrTrue
    Else
       Return InStrFalse
    Endif

End

Use example:
BoolValue = True
Txt_AmIHappy.Text = IFF(BoolValue,"Yes- Im Using Gambas","No-I have to 
use VB")

Of course this can be done with an If-Else or Select-Case but its a 
little more elegant.


Cheers,
Ian.







More information about the User mailing list