74 views
in Getting started by

Hello Everyone. 

I have a little question abuot the Chora Language : does it use Lazy Evaluation?
For example, in a code snippet like the following :

var bool A = false;
if(A && foo() )
{
  ... something something ...
}

will foo() be called?

1 Answer

0 votes
by

Hello,

in this case (with variable A being false) the expression foo() right to the && operator is not evaluated. The method is thus not invoked. The logical operators && and || stop the evaluation as soon as the result of the expression is determined. In this case the value false in operand A affects the entire expression to return false.

I hope it helps you further.

Best regards

Paul Banach

by
Thanks for the clear and speedy answer!

Best Regards
Dario.
by

It is important to add, that the evaluation is performed from left to right. That means in case of ( foo() && A ), the method foo() is invoked even if A is false.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...