[Gambas-user] Feature Request

T Lee Davidson t.lee.davidson at ...626...
Sat Feb 7 07:09:35 CET 2015


Hey Ian,

Unless I'm missing something, you're talking about an Inline IF. And, there 
already is one.

http://gambaswiki.org/wiki/lang/iif

Print IIf(True, "Yes", "No") ' -> Yes
Print IIf(False, "Yes", "No") ' -> No


Lee
__________

On 02/06/2015 08:51 PM, Ian wrote:
> 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.
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list