Loops - Reading Assignment

Loops Reading Assignment

  1. Looping control flow is executing parts of the program again and again to satisfy certain conditions.
  2. Loops let us go back in the program and execute a part of the code again.
    3 The difference between do and while loops is that do loops always execute their body at least once.
    4 Indentation is when tabs and spaces are added to make the code more readable.

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.
Allows the same task to be repeated until the conditions are met.

What is the difference between while and do-loops?
Do loops execute their code at least once unlike while loops.

What is indentation?
Indentation is used to make the program look cleaner and easier to read.

i did not understand what a do loop was from the example in the book but your break down really helped thank you!!!

is this true? a while loop will test if true before executing the program< but a do loop will always execute prior to testing? or is it a poor way to explain it

1:to go back to some point in the program where we were before and repeat it with our current program state
2:it allows you to repeat part of a program until your conditions read true
3: a while loop will test if true before executing the program, but a do loop will always execute prior to testing
4:just to keep it all clean and legible

Yes. Its true. While loop will test the condition first and will execute the code only if the condition is true.

What is looping control flow allowing us to do?
The looping control flow allow us to repeat one or more statements until certain condition is false.
Describe what “loops” do in your own words.
Loops repeat code until our condition is not true anymore.
What is the difference between while and do-loops?
The while loops , check the condition before start the loop and the do-loops check the condition after one time goes through the code of the loop.
What is indentation?
The indentation is the space we use to make our code more readable and to see easy the hierarchy of our code.

  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 allow us to reuse code instead of writing it out several times. It also allows the option of creating a checkpoint to evaluate a condition until it is met.

  3. While loops evaluate an expression before running the loop inside the braces. Do loops will always run once before evaluating an expression to see if it should continue running the loop inside the braces.

  4. Indentation is a way to keep the code easier to read for humans.

  1. Looping allows us to repeat a certain thing in the program until a condition is met.
  2. They repeat code until a condition is met, e.g. for(var i = 0; i < 5; i++) { console.log(i); }.
  3. While loops do something only while a certain condition is true. Do loops always execute the first time and after that start behaving as while loops.
  4. Identations are ther spaces in the lines of code that make the structures stand out.
  1. To return to a prior condition of code and repeat
  2. It allows for efficient programming. Repetitive code is avoided by allowing the same expression to be executed over and over till it is no longer required to execute
  3. While executes until condition is false. Do loop executes the first line regardless of whether the condition is true or false
  4. Indentation is developer formatting that isn’t required to execute code, but provides clarity to code so that it can be more easily interpreted as a developer rather than a computer

What is looping control flow allowing us to do?
Allows us to repeat a part of code with our current program state.

Describe what “loops” do in your own words.
Loops are portions of code that repeat until the required result is acomplished

What is the difference between while and do-loops?
The onlky difference is that DO loops will run at least once whereby a WHILE loops may not run if certain criteria is not met.

What is indentation?
Indentation is the formatting of code that allows a programmer to visually represent certain parts of code. For example a function would have its internal code indented making it easier to see the star and end of the same functiona nad its corresponding contents.

1. What is looping control flow allowing us to do?
It allows us to go backwards in our program and repeat it once again.
2. Describe what “loops” do in your own words.
Loops allow us to go somewhere back in our program and check if the expression is true. If it is, the program will run once again.
3. What is the difference between while and do-loops?
Do-loops will always execute at least once.
4. What is indentation?
They are the spaces we use before making our statements. Indentation is used for better reading the code and it gives us immediate representation about where new blocks are opened inside other blocks.

  1. It allows for repetitive actions to be taken until a certain criteria is met. Something like counting up to a thousand by five, for example, instead of manually typing it out one-by-one.

  2. Loops perform a set action a specific number of times. While(x <= 5), if x = 0, will run until x is greater than five. If the goal was to print “Hey” each time x was incremented, it would print it for 0, 1, 2, 3, 4, 5 and then stop at six – so it would print six instances of “Hey” to the page. This allows repetitive automation in the program.

  3. While loops run while a condition is true (x <=5) – x will run until x becomes six. A do loop typically would only run once based on a whether a condition is true or not.

  4. Indentation is intentional spacing meant to clean up code and make it easier to read and understand. An example would be putting in two spaces for the text inside of an if statement. The intent is to distinguish one part of the program from another.

  1. looping control flow allows us to go back to some point in the program and repeat
  2. it is a way to run a code over and over again
  3. while loops keeps running the program as long as the boolean value holds true while do loops starts testing the value after the first execution and stop if need be
  4. indentation is to make the structure of the code stand out. more readable.

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

Looping control flow is allowing us to go back to a previous point in the program and repeat it with our current program state.

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

Loops run a piece of code many times.

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

The difference between while and do loops is that do loops always executes its body at least once, and it begins testing whether it should stop only after the first execution.

4. What is indentation?

Indentation is making the structure of the code stand out.

1 Like

What is looping control flow allowing us to do?
Execute statements many times without typing the same statement many times.

Describe what “loops” do in your own words.
Iterate over a statement or block of statements until it reach a condition

What is the difference between while and do-loops?
do-loops always have to executed al least one time

What is indentation?
A convention to write code, it is helpful when you are reading it

1. What is looping control flow allowing us to do?
It allows us to run a piece of code multiple times and able to go back to some point in the program where we were before and repeat it with our current program state.

2. Describe what “loops” do in your own words.
Loop allows program to be repeatedly executed based on a set of logic within a certain environment.

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

A statement starting with the keyword while creates a loop.The loop keeps entering that statement as long as the expression produces a value that gives true when converted to Boolean.

let result = 1;
let counter = 0;
while (counter < 10) {
result = result * 2;
counter = counter + 1;
}
console.log(result);
// → 1024

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.

let yourName;
do {
yourName = prompt("Who are you?");
} while (!yourName);
console.log(yourName);

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

1. What is looping control flow allowing us to do?
It allows us to run a piece of code multiple times by going back to some point in the program and repeat it with the current program state.

2. Describe what “loops” do in your own words.
Loops help us to describe and execute a work that is repeated often in a short and efficient way.

3. What is the difference between while and do-loops?
While loops are executed only if the boolean expression is true. Do loops are executed one time for sure, and check to execute again at the end of the first execution.

4. What is indentation?
Shaping the code with blanks, tabs and linebreaks, so that it is readable. It makes it easier to see where one block starts and ends.

  • What is looping control flow allowing us to do?
    we can get back to some point of a program (loop) and continue with instructions again and again. this allows us to make loops
  • Describe what “loops” do in your own words.
    loops are parts of a program where we do some tasks many times depending on our conditions.
  • What is the difference between while and do-loops?
    do loop can execute at least once. after the first execution it check the condition if it should continue or not. while loop check the condition first and then it decides what to do.
  • What is indentation?
    indentation means adding space or tabs for code beeing easier to read, when some block is part of bigger block. programmers should always keep proper indetation

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.

2. Describe what “loops” do in your own words. Loops allows us to run the same code over and over again until a condition is met or until the program ends

3. What is the difference between while and do-loops? while loops evaluates the condition at the beginning whereas the do loops evaluates it at the end. This mean the code inside the do loop always runs at least once.

4. What is indentation? Indentation are spaces in front of statements that are part of some larger statement. The purpose is to make the code stand out so that it is easier to read when a block of code begins and ends.