Loops - Reading Assignment

What is looping control flow allowing us to do?
Allows us to decrease the workload of writing certain code

Describe what “loops” do in your own words.
Loops run a piece of code several times if certain boolean conditions are met

What is the difference between while and do-loops?
A while loops checks the boolean condition before executing the statement whereas a do loop executes the statement and then checks the boolean condition

What is indentation?
Indentation are spaces within the code that make it neater easier to read

1 Like
  1. 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 are repeating a code until the requirements are met.
  3. A do loop always executes its body at least once, and it starts testing
    whether it should stop only after that first execution.
  4. A way to structure your program in order to be more easy to read and see the different blocks.
1 Like
  1. A control flow allows the program to repeat a task a certain number of times without the programmer having to write it out.

  2. A loop is a repetition of a process until some objective is met.

  3. A while loop only executes if certain conditions are met. A do loop always executes at least once and then checks to see if it needs to loop again.

  4. Programmers use indentation inside blocks to make the structure of the code easy to see and understand. When new blocks are created inside other blocks, the indentations help keep everything organized.

1 Like
  1. Allows us to go back to some point in the program where we were before and repeat it with our current program state.
  2. Saves us a bunch of time. Allows us to run a piece of code multiple times.
  3. a ‘do’ loop always executes its body at least once, and it starts testing whether it should stop only after that first execution.
  4. indentation inside blocks make the structure of the code stand out.
1 Like

Good answers, @Long :ok_hand:

When describing loops, it is also important to highlight that each repetition of the code block depends on whether a specific condition is met.
Each time the loop’s code block is executed, an iterator variable — which acts like a counter — is increased or decreased by a certain amount, and then checked to see if it still meets the condition. If it does, the condition evaluates to true and the loop’s code block is repeated once again. However, if the condition evaluates to false, the loop is exited.

  1. What is looping control flow allowing us to do?
    Allows the program to loop back to an earlier part of the program until certain conditions are met

  2. Describe what “loops” do in your own words.
    Sends the program back to earlier stages of a program

  3. What is the difference between while and do-loops?
    While loops check conditions of the loop before executing and Do loops check after executing. Do loops also always execute once

  4. What is indentation?
    Spaces and gaps in code to make it easier for humans to follow, the computer does not care.

1 Like
  1. What is looping control flow allowing us to do?
    It allows us to execute a code multiple times until a condition is met.
  2. Describe what “loops” do in your own words.
    Loops defines a variable, checks if it meats a certain condition, and applies code on it. It goes back to start of the loop and executes the second iteration based on the result of the latest loop.
  3. What is the difference between while and do-loops?
    Do loops executes the code at least once before checking if the condition is met.
  4. What is indentation?
    It is structuring the code visually to make it easier to understand.
1 Like
  1. What is looping control flow allowing us to do?
    It allows us to run a piece of code multiple times.

  2. Describe what “loops” do in your own words.
    As long as an expression gives a true value, the same piece of code is executed repeatedly.

  3. What is the difference between while and do-loops?
    While loop checks the continuing condition at the start of the body of code we are repeating. Do loop does the checking at the end of the code. Do loop thus runs the code at least once.

  4. What is indentation?
    Indentation is done to make the reading of the code easier. Each block of code that is contained in a loop or if statement for example, are indented to make clearer, which line of code belongs under which condition.

1 Like
  1. allows us to go back to some point in the in the programme where we were before and repeat until the requirement is met
    2.loops repeat code until a certain criteria is met.
    3.while loops will run until the condition is false, do loops always run whether the conditions is true or false.
  2. you space out the code so it is easier to read.
1 Like
  1. Looping control flow allows us to go back to some point of our program and repeat action with our current state of program.

  2. In some cases we need our program to do one thing several time and loops helps us simplify this action so we don’t have to write each action every time.

  3. The difference is that the do-loops execute a body at least once and after the first execution start checking if they should stop executing it.

  4. Basically it is just spaces between statements. It is not necessary for a program to have them it is just for us to help us read the code better and understand where each statement or block end and begin.

1 Like

AYYYE :clap:t5::clap:t5::clap:t5::clap:t5: I C U @javedkhalil well done!

1 Like

Loops-Reading Assignment


  1. What is looping control flow allowing us to do?
  2. looping control flow allows us to repeat specific lines of code without having to rewrite it with different parameters.

  3. Describe what loops do in your own words.

    loops, loop. They circle back to inspect the environment. Depending on the side effects present they make a call.

  4. What is the difference between while and do loops?

    The definitive difference between while and do loops is a do loop will always "do it once` meaning a do loop will run the program once guaranteed.

    Before checking if it should stop.

  5. what is indentation?

    Indentation is a spacing “best practice” used to keep code legible.

    No indentations?

    No problem! The program stil runs.
2 Likes

What is looping control flow allowing us to do?

Looping control flow allows us to go backward in our code and repeat a sequence of statements repetitively using the current program environment until a desired boolean expression evaluates to either true or false depending on how the expression is constructed.

Describe what “loops” do in your own words.

Loops allow us to set a binding to a particular state and then allow us to test the state of the current binding by using expressions. Then by altering the current state of the binding we can then test the binding again to check its new state. we have the possibility of running these loops to infinity or breaking out after binding evaluates to desired value.

What is the difference between while and do-loops?

The difference between a do and a while loop is the body of the do loop is executed at leat once. also the conditional test of the do loop appears at the end of the loop body where the while loop condition is tested before the loop body.

What is indentation?

Indentation is the clever use of white space to clearly group blocks of code which are related to each other into defined start points in our source code. it allows us to make our code easier to read because when we have nested blocks indented it is easier to see where blocks begin and end.

2 Likes

Excellent answer sir! really well documented! keep it like that please! :muscle:

Carlos Z.

2 Likes

Love it… :rofl:
…the art of managing complexity :wink:

1 Like
  1. Looping control flow is allowing us to run a piece of code multiple times.
  2. Loops allow us to repeat code until a condition is met.
  3. While loops execute while a condition is met, a do loop always executes at least once.
  4. Indentation is when you hit a car with a baseball bat. jk. Indentation is aligning code to give a visual indication of how tiered levels of code will execute.
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.
  • For example:

let number = 0;

while (number <= 12) {

console.log(number);

number = number + 2;

}

// → 0

// → 2

// … etcetera

  • A statement starting with the keyword while creates a loop.

Describe what “loops” do in your own words.

  • The loop keeps entering that statement as long as the expression produces a value that gives true when converted to Boolean.

What is the difference between while and do-loops?

  • 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.
  • For example:

let yourName;

do {

yourName = prompt(“Who are you?”);

} while (!yourName);

console.log(yourName);

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

Excellent answer sir! really well documented! keep it like that please! :muscle:

Carlos Z.

1 Like
  1. A looping control flow allows us to run a code as many times as we want, each time with a different value.

  2. Loops make it possible to simplify coding by reusing “old” code.

  3. WHILE and DO WHILE works on a block of code while a specific condition is true.
    But in the DO WHILE loop the code block is executed before the condition is tested, so the loop will always be executed at least once even if the condition is false.

  4. Indentation is way to keep the coding neat and organized by placing the code blocks at different numbers of spaces from the margin.
    It helps the general overview and makes flaw detection easier.

1 Like
  1. Less, by allowing us to run part of the code multiple times
  2. They run part of the code multiple times without us having to write it multiple times
  3. A do loop always executes at least one time.
  4. Moving the next line forward to show its connection to the above line
1 Like