পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Wednesday, February 1, 2017

Euphoria - Short Circuit Evaluation

When a condition is tested by if, elsif, until, or while using and or or operators, a short-circuit evaluation is used. For example −
if a < 0 and b > 0 then
   -- block of code
end if
If a < 0 is false, then Euphoria does not bother to test if b is greater than 0. It knows that the overall result is false regardless. Similarly −
if a < 0 or b > 0 then
   -- block of code
end if
if a < 0 is true, then Euphoria immediately decides that the result true, without testing the value of b, since the result of this test is irrelevant.
In General, whenever you have a condition of the following form −
A and B
Where A and B can be any two expressions, Euphoria takes a short-cut when A is false and immediately makes the overall result false, without even looking at expression B.
Similarly, whenever you have a condition of the following form −
A or  B
Where A is true, Euphoria skips the evaluation of expression B, and declares the result to be true.
Short-circuit evaluation of and and or takes place for if, elsif, until, and while conditions only. It is not used in other contexts. For example −
x = 1 or {1,2,3,4,5} -- x should be set to {1,1,1,1,1}
If short-circuiting were used here, you would set x to 1, and not even look at {1,2,3,4,5}, which would be wrong.
Thus, short-circuiting can be used in if, elsif, until, or while conditions, because you need to only care if the result is true or false, and conditions are required to produce an atom as a result.

No comments:

Post a Comment