Loops - Reading Assignment

What is looping control flow allowing us to do? allows us to go back to a point in the program before and repeat it with the program's current state.


Describe what "loops" do in your own words. it's a running of a program over and over again until it's stopped.

What is the difference between while and do-loops? the while excutes if true and the do executes ones and tests to see if it needs to run again.

What is indentation? adding spaces to code to make it stand out.
1 Like

Looping control flow causes the computer to jump back to a previous part of the program. A loop will normally go back to a designated part of the program recurrently until a predefined condition is met. Through looping a task can be performed repetitively without having to write a proportionate amount of code.

In a while loop the looping condition is tested at the beginning of the loop. Do loops on the other hand test the looping condition at the end of the loop. A do loop will therefore execute the loop task at least once. This is in contrast to a while loop where the loop task may not be executed at all if the loop condition is not met.

Indentation is the practise of adding spaces or tabs to make the code more readable to the programer. The tabs or spaces are added each time a new block of code is added such that blocks within blocks have their own distinct alignment.

1 Like

**What is looping control flow allowing us to do?
Running piece of code multiple times.

**Describe what “loops” do in your own words.
loops is like the four seasons, when temperature, moisture, all these conditions happened, then come spring, summer, autumn, and winter.

**What is the difference between while and do-loops?
A do loop starts its execution at least once.

  1. What is indentation?
    Indentation is the space to make the programming’s structure more clear.
1 Like
  1. It allows us to go back to some point in the program where we were before and repeat it with our current program state.
  2. Loop is a cycle where the program keeps going back to perform a task it has already performed until a condition is met so it can go forward with a different task.
  3. They differ by evaluating the condition at different points. A do loop is evaluated at the end but a while loop at the beginning. A do loop will be executed at least once and a while loop may not be executed.
  4. It is the space in front of statements that make it easier to read and it is not necessary.
1 Like

Thank You @jon_m for clearing that up for me. I did slightly get confused with the loops. But i think you have cleared that up for me. :blush: :facepunch:

2 Likes
  1. Allows programs to repeat a set of instructions (code statements) located inside the loop block as long as a specified condition is true. Looping control flow allows us to go back to some point in the program where we were before and repeat it with our current program state.

  2. Loops have two parts. one part is a boolean expression and other is the statement. As long as the expression value would be true, the statement gets executed.

  3. a least the do-loops is executed one time, on the opposite if the condition a the entry of
    the while is not met, there will be no execution.

  4. Indentation is the increase or decrease of space between the left and right margin (space) of a paragraph or line or statements so that code hierarchy make sense and code becomes more readable.

1 Like

Yes, You’re perfectly right, @javedkhalil’s diagram is fine. That was arrogant from me, I’m sorry for that. And I have nothing to say about that. Nonetheless I do prefer the more abstracted nomenclature of the While-Loop that talks about Condition (in which “expressions” is more precise) and “body” (in which Statements is also more precise) cause they both provide for a much open and flexible understanding of what is at stake in this chapter and may also help me with reminding correct syntaxe :

  • While (condition) {body} ;

or

  • While (condition (fonction (expression)) {body { statement ( fonction (expression) ) ;
    statement ( fonction (expression) ) ;} } ;

Am I getting clearer ? :woozy_face:

1 Like
  1. Looping control flow is a control flow that allow us to go back to a specific sentence in the control flow of the running program.

  2. Loops are tests of a condition that return false and readdress the control flow to a previous sentence until the condition is true and triggers the control flow that’s inside the body of the loop ;

  3. While the while -loops are loops that will execute the body after the condition is met, do loops will always execute the body at least once.

  4. Indentation is a visual organisation of the code that makes its readability much easier.

1 Like

Looping control flow allows us to go back to a certain point in the program and repeat it using our current state.

Loops make repetitive tasks simple and less time consuming, by creating code that handles the work for us.

The difference is that “do” loops always executes it’s body at least once, and then determines if it should continue on.

Indentations are line breaks with added spacing, that gives structure to the code. Mainly so it is easier to read.

1 Like
  • What is looping control flow allowing us to do?

Looping control flow simplifies a program by repeating an existing piece of code within a program when relevant (eg counting).

  • Describe what “loops” do in your own words.

Loops come back to an initial command in a program to as not to have to recreate that command every time it is needed. Essentially like a “running tab” at a bar so you don’t need to create a new bill with every order.

  • What is the difference between while and do-loops?

As described in the textbook while and do loops are essentially the same, the only difference being a do loop will always execute at least once. To be honest this distinction is a little unclear - when would a while loop NOT execute at least once? And therefore what would be the point? Unless the loop was the point of the program, and to run the program certain conditions had to be met in the first place. I suppose. Still a little Greek.

  • What is indentation?

Indentation is simply spacing used by programmers to make the code easier to follow. It is nconsequential to the actual operation of a program.

1 Like
  1. Looping control flow allows you to repeat a set of instructions from a previous place in the code and repeat it.
  2. Loops reduce the size of a program by cycling through a set of code for a specified criteria, it is a repetition of a process until a certain condition/criteria is met
  3. do loops will execute the code once before checking the condition of the loop. While loops will only run if certain conditions are met.
  4. Indentation makes the program code cleaner and easier to read, basically code formatting.
1 Like
  1. Looping control flow lets the program repeat a step without programming each step manually
  2. Loops repeat a process until a numeric limit is reached or a condition is met
  3. A while loop runs only if a certain condition is true. A do loop always runs once
  4. Indentation is spacing from the left margin, to make the code structure readable
1 Like
  • What is looping control flow allowing us to do?
    make repetitive tasks simple and quicker to execute
  • Describe what “loops” do in your own words.
    loops allow you to execute a block of code repeatedly until a specific outcome occurs, which depends upon the type of loop you are using and the inputs used.
  • What is the difference between while and do-loops?
    do loops must execute the block of code at least one time and does not check if it should stop until after that first run
  • What is indentation?
    a way of making code structured and readable for you and others
1 Like
  1. What is looping control flow allowing us to do?
    Looping control flow allows us to go back to some point in the program where we were before and repeat it with our current program state.
    5a66416b46abbc5b6f0d221b0e955f6a

  2. Describe what “loops” do in your own words.
    They loop a piece of code.

  3. What is the difference between while and do-loops?
    A do loop is a control structure similar to a while loop. It differs only on one point: a do loop always executes its body at least once, and it starts testing whether it should stop only after that first execution. To reflect this, the test appears after the body of the loop.

  4. What is indentation?
    The role of this indentation inside blocks is to make the structure of the code stand out.

1 Like
  1. Looping control flow is allowing us to go back to a stated point in the program and repeat the process.

  2. Loops are a way of going over the same process again and again.

  3. The difference between while and do loops are that do loops continue until the program has be executed but while keeps on going until it gets something.

  4. Indentation is creating a space or multiple spaces at the start of a line by suing the space bar or tab. This helps with keeping the code easy to read.

1 Like

What is looping control flow allowing us to do?

Looping control flow allows us to go back to some point in the program where we were before and repeat it with our current program state.

Describe what “loops” do in your own words.

Loops repeats the commands until conditional statement gives different value. Like run until you get certificate. Javascript runs the function like legs repeats the same movement if this function has brought the runner then foregoing run function ends.

What is the difference between while and do-loops?

while checks its condition first but the do executes at least once and performs a check at the end to see if the condition is met to execute again.

What is indentation?

The role of this indentation inside blocks is to make the structure of the code stand out. In code where new blocks are opened inside other blocks, it can become hard to see where one block ends and another begins. With proper indentation, the visual shape of a program corresponds to the shape of the blocks inside it.

1 Like
  • What is looping control flow allowing us to do?
    Looping control flow allows us to go back to some point in the program where
    we were before and repeat it with our current program state.
  • Describe what “loops” do in your own words.
    Loops tell the system to repeat the order over and over until a certain condition is met.
  • What is the difference between while and do-loops?
    A statement starting with the keyword while creates a loop. The word while
    is followed by an expression in parentheses and then a statement, much like if.
    The loop keeps entering that statement as long as the expression produces a
    value that gives true when converted to Boolean.
    A do loop always executes its body at least once, and it starts testing
    whether it should stop only after that first execution. To reflect this, the test
    appears after the body of the loop.
  • What is indentation?
    The role of this indentation inside blocks is to make the structure of the
    code stand out. In code where new blocks are opened inside other blocks,
    it can become hard to see where one block ends and another begins. With
    proper indentation, the visual shape of a program corresponds to the shape of
    the blocks inside it.
1 Like

Hey @Gae_mon,

Perfectly clear :slightly_smiling_face:

There was nothing arrogant about your post — I was just a bit confused by it :wink:  Anyway, it’s turned into a healthy discussion, which is great :+1:

I totally agree that the terms condition and body provide a better overview of the structure of a while loop. I just wanted to point out that expression and statements was also correct terminology. But I wouldn’t say they are more precise, rather just alternative terms to use depending on what you are trying to conceptualise, and at what level of detail.

2 Likes

Loops
What is looping control flow allowing us to do?
It allows us to go back to some point in the program where we were before and repeat it with our current program state.

Describe what “loops” do in your own words.
Loops can execute a block of code a number of times and are used for automating repetitive tasks.

What is the difference between while and do-loops?
while loop executes a block of code for as long as a specified confition is true.
do…while loop will always execute once, even if the condition is never true.

What is indentation?
Using additional spaces in front of statements to create a margin and give the code a visual shape/structure thus making it easier to see where each block starts and ends.

2 Likes

What is looping control flow allowing us to do?

  • Looping control flow allows us to go back to some point in the program where we were before and repeat it with our current program state

Describe what “loops” do in your own words.

  • a piece of program repeating instructions until the condition is met to leave the loop

What is the difference between while and do-loops?

  • a do loop always executes its body at least once because the testing condition is after the loop has excecuted onces
  • a while loop test BEFORE the code excecutes onces

What is indentation?

  • identation are spaces befoe code to make it more readable the pieces of code inside a block (loops for example)
1 Like