Loops - Reading Assignment

  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. It is a form of control flow to run a piece of code multiple times.
  3. “While” loops keep entering a 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.
  4. Indentation is spacing to make the structure of the code stand out.
1 Like
  1. it is allowing us to take alternate paths to reach the same result.
  2. A loop is a function that execute a statement/s continuously until certain conditions are met.
  3. While loop executes a code over and over again while a certain condition is true. It will execute the entire loop at once. Do loops execute the following statement first before executing the rest of the code.
  4. Indentation is the spacing on each line that helps organize code in a logical manner.
1 Like

To allows to repeat a certain program many times, this allows to us do to less works.
2. Loops repeats the program with the described statements, it can continue as long as you want it.
3. A while loop continues the program if the value is true but the DO loop runs at least once and it starts testing if it should stop.
4. Indentation is the way code is formatted, this helps to read and understand code hierarchy.

1 Like
  • hat is looping control flow allowing us to do?
  • It alows us to go back to some point in the program where we were before and repeat it with our current program state, withouth having to type everything again and again…

  • Describe what “loops” do in your own words.
  • Loops make possible for us to do over and over some task with slightly different input withouth having to change code all the time.

  • What is the difference between while and do-loops?
  • The while loops contain a program that is usually set up in a way where we have a keyword followed by an expression in parentheses and then a statement. The loop keeps entering that statement as long as the expression produces a value that gives true when converted to Boolean.
  • A do loop is a control structure similar to a while loop. It differs only on one point : it has to execute it’s body atleast once. It asks of a user to do something and it will keep repeating until the user does something that the program is asking of him.
    (Now I am not sure for this “do loop” did I understand well what it does, I think I did but if it is wrong my understanding of it I would appreciate if anyone would correct me :slight_smile: )

  • What is indentation?
  • It is added empty space that makes structure of the code stand out. It is not necessary to do this but it could help you or other coder to find things easier and see better the code. The computer does not care about it, it will execute the program with or withouth indentation.
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.

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

Looping control flow allows us to run a piece of code multiple times without having to write each statement individually.

  1. What is the difference between while and do-loops?

A Do-Loop always executes its body at least once, then it starts testing whether it should stop only after the first execution.

  1. What is indentation?

Indentation is a way of structuring a program in order to make it easier to read. The spaces we add don’t affect the content, in fact one could write a whole program in a single line if that’s what he wants.

1 Like
  1. it allows us to repeat parts of our program.
  2. Loop is a way to repeat codes
  3. DO loops execute the whole body at least once when WHILE loops can execute parts of body
    4 Putting spaces between words and commands so that the program on screen looked less complicated
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.

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

Its an statement that creates a condition to be met for execution.

  1. 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.

  1. What is indentation?

The role of this indentation inside blocks is to make the structure of the code stand out. highlight the area you want to indent and press TAB.

1 Like
  1. Looping control flow allows us to reuse code for multiple iterations of a section of code. In this way it’s more efficient than writing multiple sections of the same code.

  2. Loops are like laps around a racetrack, until the red or checkered flag is waved the cars keep going around the track. In a program the loop keeps on iterating until a condition that causes it to end occurs.

  3. A do-loop will always execute at least once, while a while loop will only execute when the condition is true.

  4. Indentation is where certain sections of code are spaced differently from the margin to make it easier to read. The standard indentation is 2 spaces.

1 Like
  1. Looping control flow allows us to go back to the point we desire in the code previously and repeat the part of the code we intend repeating.

  2. Code runs from the top to the bottom. That’s how to control flow usually goes. However, it can be changed to go back and fourth using loops. For ex: Lets say you want a variable to be counted to reach a certain number that it isn’t already. With a while loop you can let the number be added by a certain amount until it reaches the desired amount.

  3. A do loop is executed at least once while false. For ex:
    let x = 0;

do {
// Increment variable by 1
x++;
console.log(x);
} while (false);

It can only do this variable once because if while is true the loop will go indefinitely.

While loops are different however because they can go more than once for ex:
var i = 0;

while (i<=10) {
i=i+1;
};

This loop starts true and ends false. It will keep adding i by 1 until it is larger than or equal to 10. Once it does reach its goal the loop ends false. The difference is the do loop starts false while the while loop ends false.

  1. Indentation is when spacing between the left side of the code is put to make reading the program easier to do. For example with HTML tags you have the head, the title, the html, the body, the headings etc. When you indent the work so that things like paragraphs and heading are indented inside the body, you know where the tag starts and ends.
1 Like

1. What is looping control flow allowing us to do?

  • To run a piece of code multiple times.

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

  • Loops execute code again and again and it will only stop until a specific value has been achieved.

3. What is the difference between while and do-loops?

  • A while loop checks the condition after it executes the code and a do loop executes the code before checking the condition.

4. What is indentation?

  • Lines of code are sometimes moved to the right in order to make the contents more readable.
1 Like
  • What is looping control flow allowing us to do?
    

It gives us the flexibility to go back into the code and repeat something in the same program.

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

Loops allow programmers to repeat something multiple times until a condition is met. This helps to shorten the amount code you need to write to perform the same function.

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

A do loop executes it’s body at least once, while a while loop continues until the condition is true.

  • What is indentation?
    

Indentation is spacing that creates structure. This makes the code easier to read and troubleshoot.

1 Like
  1. Compute iterations until a desired threshold is met.
  2. They perform a sequence function that stops based on a variable and displays a result.
  3. A while loop tests if a breaking condition is met before its first run, a do loop runs its first operation then tests.
  4. Pressing enter when coding to make some code stand out.

I tried the code from breaking out from a loop p.33
It returns a syntax error unless I enter a third expression limiting the range of current between the brackets after for.

1 Like
  1. What is looping control flow allowing us to do?
    It allows us to some previous point in the program, and repeat the execution with the current environment.

  2. Describe what “loops” do in your own words.
    Execute a piece of code while a certain condition is met.

  3. What is the difference between while and do-loops?
    In a while loop we first evaluate the condition, then execute. In do-loops we first execute, then evaluate.

  4. What is indentation?
    Adding spaces to the source code in order to make it more readable and give it some structures (in some languages, indentation is a structural part of the syntax of the code. If not correctly done, code may not execute as expected).

1 Like

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

Carlos Z.

1 Like
  1. Let us write less code to solve a repetitive task.
  2. Loops repeat a task until a condition is met
  3. Do loops force at least one run through the code, while while doesnt.
  4. Indentation is used to format your code into blocks that are more easily readable than one single line of code
  1. Looping control flow allows us to run a piece of code multiple times.
  2. A loop is something that go back to a point in the program where we were before and repeat it with our current program state.
  3. A loop always executes its body at least once, instead while verify the condition at the beginning.
  4. Indentation makes the structure of the code stand out.
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. Loops enable complex calculations to be made simpler. A loop is a piece of a program that will repeat certain steps until a specified result is reached.’
  3. Do loops always complete all tasks in their body at least once.
  4. Indentation is an organizational method to make reading and writing code easier and quicker to comprehend.
1 Like
  1. Looping allows us to run a piece of code multiple times.
  2. Loops make the program to run, go back and do it over and over again until it reaches a certain predefined endpoint.
  3. the do loop always executes its body at least once, and it starts testing
    whether it should stop only after that first execution
  4. This indentation inside blocks makes the structure of the code stand out.
1 Like

1 is allows to run a piece of code multiple times

2 it allows the computer to do the same calculation a certain number of times (it is a form of automation the calculation)

3 do : it does a part of the program if there is an imput
while ; if a condition is met it runs a part of the program

4 to put for example spaces in a way it is easier to read the code, the structure of the code is standing out

1 Like

[quote=“ivan, post:1, topic:3077”]

  • What is looping control flow allowing us to do?
    To go back to a point in the program where we created the condition and repeat it.
  • Describe what “loops” do in your own words.
    Loops execute and repeat a block of code until one of it s condition breaks the loop
  • What is the difference between while and do-loops?
    A do loop is like a while loop but it’s different is in there conditions to execute and repeat the loop.Do loop executes its body at least once and only after does it decide to repeat the loop.while is looking at the condition first and each time before to execute or reexecute the programme
  • What is indentation?
    Indentation is to make life easier by structuring the code in a more readable and organised way.
1 Like