[Gambas-user] Eval Gambas2
Ron
ron at ...1740...
Wed Jan 5 10:27:47 CET 2011
On 5-1-2011 10:23, Benoît Minisini wrote:
>> Hi,
>>
>> I'm trying to implement some sort of basic scripting with the use of
>> Eval() inside my project.
>>
>> It works for a lot of math, formatting and comparison commands and works
>> quite nicely.
>>
>> But I need the IF THEN to work too.
>>
>> IIf ( Test AS Boolean , TrueExpression , FalseExpression ,
>> FalseExpression ) or
>> If ( Test AS Boolean , TrueExpression , FalseExpression )
>>
>> Works, but evaluates both TrueExpression and FalseExpression regardless
>> of test (as explained in docs)
>>
>> Is there a way to get
>> IF Test THEN TrueExpression
>> to work inside Eval() ?
>>
>> Regards,
>> Ron_2nd.
>>
> No way. Eval() only evaluates expressions.
>
Ok clear ;-)
Got some sort of work around so I can use IIf the way I want, instead of
If(Dev_26_Value = "On", Twitter.PostTweet("TV is On!"),
Twitter.PostTweet("TV is Off!"))
do:
Twitter.PostTweet(If(Dev_26_Value = "On","TV is On!", "TV is Off!"))
Shorter anyway...
Regards,
Ron_2nd.
More information about the User
mailing list