Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:41:18+00:00 2026-06-08T11:41:18+00:00

I have somehow hard time in understanding the following program in LOOP (you can

  • 0

I have somehow hard time in understanding the following program in LOOP (you can also read the article in its original German), which is supposed to simulate IF x=0 THEN A END.

y:=1;
LOOP x DO y:=0 END;
LOOP y DO A END;

How exactly does this simulate an IF statement? Why can’t I do this:

x:=0;
LOOP x DO A END;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:41:20+00:00Added an answer on June 8, 2026 at 11:41 am

    I have no idea what this language is but if one assumes that LOOP cntr DO stmt END; executes stmt as long as cntr is greater than zero (and it’s decremented after each iteration), then this works as follows:

    1 is assigned to y. If x is greater than zero, then y is assigned 0. If x is zero the value of y remains 1. In the next loop, A is executed once if y is 1 which is the case only if the previous LOOP statement didn’t execute, that is if x was equal to 0. The main advantage of this construct is that A is executed only once and not as much times as is the value of x if it is greater than zero which LOOP x DO A END; would do.

    Here is the logic once again, step by step:

    • y is set to 1
    • y is set to zero x times. This is equivalent to IF x <> 0 THEN y:=0 END
    • A is executed y times (once if x is zero and zero times if x is non-zero)

    Those three steps translate to: if x is zero, execute A once, otherwise execute A zero times (i.e. don’t execute).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been having a hard time understanding how to use a singleton to
Hello I have one c++ Programming assignment question. I tried hard but somehow I
I'm having hard time wrapping my head around this. I have an array called
I have a big problem, and I am having a hard time solving it.
Newbie here, having a hard time understanding Class methods and why I cannot get
I have somehow managed to break my infopath form :( When I try to
I have somehow managed to get a really screwed up Eclipse project. I have
I somehow have the feeling that modern systems, including runtime libraries, this exception handler
I have a somehow funny issue. While trying to understand why a certain website
The problem that I have is somehow very specific. I have to implement a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.