On Fri, 22 Nov 2013, derox wrote:
> Hi!
> 
> Though I have limited knowledge of C++, I do believe it has the following
> functionallity that also could be useful in Gambas:
> 
> If you have an IF-block with several statements that are to be evaluated,
> in C++ it will jump out of that evalutaion proccess as soon as it
> encounters a true statement. That way you can put procedure-calls from the
> IF-block that would normally crash the program if the prior checks are
> TRUE, but otherwise would run successfully.
> 

Well... I think you mean: jumps out of a chain of ORs when a TRUE statement
is reached and jumps out of a chain of ANDs when a FALSE statement is
reached?

> Just a silly example
> 
> If(itsWinterTime OR iceCreamWagonIsOpen) Then 'There are no Ice Wagons
> around in Winter, and the program will wonder what you are talking about
> and go crash sending out an Error message, but if it is summer time, there
> will be a ice wagon, but it is not neccessarily open :)
>    ...
> End if

This is called short-circuit evaluation and Gambas has it. Look at... the
documentation of If[0].

Regards,
Tobi

[0] http://gambasdoc.org/help/lang/if?v3

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to