Loops - Reading Assignment

  1. What is looping control flow allowing us to do?
  • Looping control allows us to go back into some point in our program and repeat it with the current program state
  1. Describe what “loops” do in your own words.
  • Loops allow us to have either parts of the our program or the entire program repeat on its own rather than us adding the same statements over and over again so the output can occur for x amount of times
  1. What is the difference between while and do-loops?
  • Do-loops differ form while loops because a do-loop always executes its body at least once and it starts testing whether it should stop only after the first execution
  1. What is indentation?
  • Indentation is used for structuring purposes. This way blocks of code are able to stand out. Additionally it helps with organizational purposes.
1 Like
  1. Looping control flow runs a set of numbers until the program stops at a number set in the program. Looping control flow allows for going back in the program, where the program had already been and repeat that spot. Using the example of starting at 0 and going up to 12 using even numbers, the program will count through the even numbers until the counted number reaches 12 plus is equal to 12. Using a binding that is counting will help achieve this result. The let keyword is used to activate the binding.

  2. A loop is a program that continues to a point set out in the program. There are two keywords that can activate a loop: ‘while’ and ‘do’. The while keyword also needs other parts to the string to have the loop run such as an expression in " " and a statement. The loop will continue to return to a part in the program and execute from there until a set point is reached in the program.

  3. The while loop as explained in the previous answer, allows a loop to be created. The word while, also needs an expression in parentheses and a statement to guide the program with instructions. The statement created for the loop continues, as long as the values produced from the expression are true. Once the set point is reached, the loop should end.
    The do loop is similar to a while loop. There is once main difference which is, the do loop will always execute its body once, and then starts testing whether the loop should stop after executing the program once. An example of the do loop is:

let yourName;
do {
    yourName = prompt ("Who are you?");
} while (!yourName);        --> The loop will continue until a name is given.
  console.log (yourName);
  1. Indentation is when the code is structured in a way that makes it readable for the coder or others. Blocks of code that go together can have an indentation on continuing lines from the first line of code. The visual example given here will show the indentation:
if (false = true) {
   console.log ("That makes sense.");  --> The bold letters will fall under the brackets @ false and align
   if (1<2) {
   console.log ("No surprise there."); 
   }
}

Edit @ivga80 (You can use the preformattet text button to show the code in the post).

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. it is a repetition of statement until a criteria is met
  3. Do loop has to run once. While loop checks whether a statement is true or false first
  4. It is a way to structure the code and makes it readable
1 Like
  1. Looping control flow allows us to perform a sequence of unique operations while making changes to state along the way.

  2. Loops are chunks of code that repeat a certain number of times, or under certain circumstances.

  3. a do loop will execute at leas one time before it checks if its condition has been met/.

  4. Indentation it the visual sugar that we put on our code so that it is easier to read.

1 Like
  1. What is looping control flow allowing us to do?
    Allows us to go back to some point in a program and repeatedly execute statements until a condition is met

  2. Describe what “loops” do in your own words.
    Loops are programs that continue to run in a repeated fashion until a condition is met

  3. What is the difference between while and do-loops?
    Do loops always execute the loop at least once. The condition to check against comes after the statement to execute.

  4. What is indentation?
    Adding spaces, line breaks, and other sort of indents into the actual code to make it more readable. These spaces do not serve any programmatical purpose.

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 repeat an operation if certain conditions are met
  3. 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.
  4. Indentation helps make the code more easily readable as it makes the structure of the code stand out.
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 allows us to write a piece of code multiple times, so we can save time like this.
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 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
  1. Looping control flow allows repeating a repetitive action in the program based on a set of conditions.

  2. A loop when a program repeats an action based on a condition.

  3. A while loop evaluates the condition first then decides if it will run. A do loop will always run at least once then evaluate the condition after the first loop.

  4. Indentation is a space in the programming that makes it easier to read. It has no effect on the function of the program.

1 Like
  1. Looping control flow allows us to do consistent and continuous functions by itself in order to fufill a certain criteria, a.k.a repeating functions.
  2. It is a repetition function, creating the sequence again from the beginning to end of loop statement.
  3. A while loop will constantly check the criteria and will execute the given commands depending on the criteria. A do loop will only execute the loop for a fixed number of times given by the programmer.
  4. Indentation is the increase or decrease in space between the left and right margin of a paragraph to ensure that the statement is easier to read.
1 Like
  • What is looping control flow allowing us to do?
  • To go back to some point in the program where we where before and repeat it.
  • Describe what “loops” do in your own words.
  • A loop runs a piece of code many times as long as it gives a value “true” in boolean.
  • What is the difference between while and do-loops?
    -Keyword while creates a loop and it will run the code several times until reaches a value “true”. A do-loop while execute at least once and it will test if should stop only after it gets a valid input.

  • What is indentation?
    In order to make the structure of the code stand out we use indentation. Is the use of spaces between blocks of code.

1 Like

What is looping control flow allowing us to do?
It’s a function for repeating a computation without having to write out every single calculation in the code of the program
Describe what “loops” do in your own words.
The repeat a process until certain conditions have been met: becomes false, finds a break or a return statement
What is the difference between while and do-loops?
A do-loop executes statement then evaluate the result.
A while loop examines the result of the loop before execution
Practically it means a do-loop runs at least once while a while-loop only runs if pre-conditions are met
What is indentation?
Empty space on left and right hand side of code that creates a breather for the eye and makes code easier to read

1 Like
  1. What is looping control flow allowing us to do?
    They allow to return to a previous point in the program with the current state. This allows to repeat multiple times a statement or multiple statements.

  2. Describe what “loops” do in your own words.
    Loops allow to repeat statements until a condition is met.

  3. What is the difference between while and do-loops?
    The do-loops execute at least once since the condition is checked after the first execution. The while loop checks the condition before entering the loop.

  4. What is indentation?
    Indentation is the spacing at the start of a statement to show that it is a separate block of code. This allows for easier reading of code.

1 Like
  1. It allows us to go back to the code in the certain place we were before and repeat it with our current program state.

  2. Loops through a block of code while a specified condition is true.

  3. A while loop is followed by an expression, while a do loop is a control structure which always executes it’s body at least once.

  4. An indentation are breaks/spaces in a code to make it stand out and easy to read.

1 Like
  1. looping control flow allows a program to go back to certain point in the program while saving the changed state of the program.

  2. Loops basically repeat a certain piece of code until a certain condition is met.

  3. A while loop will first verify if a condition is true, then it repeats action until the condition is found to be false. A do while loop executes an action then it verifies if the condition is true or false.

  4. Indentation is used to structure code to be more easily read and understood for human beings. This is important when we need to look over our code in case we need to debug.

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.
    It repeats a process until a condition is met.

  • What is the difference between while and do-loops?
    A do loop always executes its body at least once, and it starts testing whether it should stop only after that first execution. A while loop will run until the condition is false.

  • What is indentation?
    Indentation inside blocks is to make the structure of the code stand out

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 execute a conditional calculation, updating the program state, and then return to the conditional calculation again. If the conditions are met, it keeps running. The loop stops when the latest program state does not meet the conditions anymore, or when the program meets the break.

  3. They are the same, but the only difference is that a do-loop will execute its program at least once.

  4. Spaces in the code, to make it more understandable and readable for humans.

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

It allows us to go back to a piece of program written before and repeat it in the current state.

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

Running a piece of code multiple times until a threshold or parameter is reached.

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

Do loops always execute their body at least once, and determined whether to continue after that execution.

  1. What is indentation?

Indentation allows the code to be more readable, but it is not an absolute requirement.

1 Like

Answers

  1. Looping control flow allows us to run a piece of code multiple times. We can go back to some point in the program and repeat it.

  2. Loops are very important in coding. They through a block of code while a declared condition is true, so we can write a program with less work.

  3. Keyword while is followed by an expression in parentheses and then a statement. A do loop is similar to while. It differs only because a do loop always executes it body at least once, and it starts testing whether it should stop only after that first execution.

  4. Indentation make the structure of the code stand out. So with the proper indentation, the visual shape of a program corresponds to a shape of the block inside it. It’s not required, the computer will accept the program even without them, but it’s very useful, as well as the use of comments.

1 Like

1.It allows us to break the normal control flow top to bottom and move back to repeat steps already completed.

2.Loops allow repetitive code to be repeated over and over while being updated by updated bindings within the loop.

3.They are similar except that the do-loop will always complete the loop at least once, before testing for a break situation.

4.Indentation is used to make you program more readable by using tabs or spaces, allowing you to easily see the start and ending of blocks.

1 Like
  1. Looping control flow is allowing us to go back to a point in the program where we were before and repeat it with our current environment.
  2. Loops allow for a portion of code to be repeated to complete repetitive tasks.
  3. While loops test the condition before executing the code inside the parenthesis. Do loops always execute the code inside at least once and check for the condition at the end.
  4. Indentation is not required by the computer, but it helps to visualize code in such a way that humans can better understand where certain elements of code start and end.
2 Likes