Loops - Reading Assignment

#343
  1. Looping control flow allows us to design conditional code that interrupts the logical top down flow and executes Code based on values in the program.
  2. Loops allow repetitive iterations of code.
  3. WHILE loops execute WHILE a condition is true (ie - c < 10) DO loops execute at least once, then check for true or false, conditioning the second pass.
  4. Indentation is a practice of vertically lining up loops of code so that they “nest” inside each other in the code. Indentation creates a more readable program.
#344
  1. What is looping control flow allowing us to do?
    Run a piece of code over and over again.
  2. Describe what loops do in your own words.
    Allow us to repeat code until a condition is met. To control types of input by the user. To repeat a process a variable amount of times.
  3. What is the difference between while and do loops?
    Do loops preform the output at least once… while loops check the criteria before the first run.
  4. What is indentation?
    Part of the visual formatting of your code that makes it easier to read.
#345

#346
  1. Looping control flow allows us to manipulate the execution order of a program, so instead of going from top to bottom it may go to another point.
  2. Loops repeat an operation until a condition is reached, in which case the loop is exited.
  3. While loops check for a condition and execute the loop until that condition is reached. If the condition is true on the initial run, the loop will not be executed. Do-loops complete the action at least one time before checking if a condition is true.
  4. Indention helps with readability to the programmer of different segments of the program. It does not affect the execution of the program.
#347
  1. Looping control flow allows us to iterate over a data structure multiple times

  2. Loops allow a programmer to loop through a data structure multiple times in order to update the behaviour of the program/application when the data within the structure meets a specific condition.

  3. A programmer should use while loops to iterate over a data structure when it is unknown how many times the loop needs to be executed whereas they should use a do while loop if they know that it must be executed at least once!

  4. Indentation is used to basically make a program readable. The conventions vary a little but basically the procedure is that when you create a new function or loop, you indent the block inside that function/loop body a certain number of spaces e.g. typically 2 or 4 spaces

function myMainFxn() {
  // indent 2 spaces on body of function
  const data = [1, 2, 3, 4];

  for (i = 0; i < data.length(); i++) {
    // indent 2 spaces again on function body
    // do something data is certain value e..t.c
 }
}
#348
  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. A loop repeats an action as long as the the expression contained in the statement is true and stops when it becomes false. A counter that counts the number of loops can be included in the statement.

  3. A while loop keeps entering a given statement as long as the expression is true. A do loop differs in that it always execute its body at least once, and it starts testing whether it should stop only after that first execution.

  4. Indentation is adding spaces (or tabs) in front of statements that are part of some larger statement. These spaces are not required, but they help reading the code and make it structure stand out.

#349

Reading Assignment - Loops

  1. What is looping control flow allowing us to do?
  2. It allows us to run a piece of code multible times by repeating it.

  3. Describe what “loops” do in your own words.
  4. Loops are helpful tools to iterate a piece of code.

  5. What is the difference between while and do-loops?
  6. do loops always executes its body, while while loops are asking for a condition before. The condition in do loops can be written after the body.

  7. What is indentation?
  8. Identation are optional spaces and linebreaks which gives the code a structure.

#350

What is looping control flow allowing us to do?

It allows us to go back to a certain place in the code and let it repeat.

Describe what "loops" do in your own words.

Loops repeat actions in the code as long as we program to do so.

What is the difference between while and do-loops?

In While loop, condition is tested at the beginning of the loop. In a do loop the condition is tested at the end.

What is indentation?

The way how you write (meaning graphically) your code. I.e. using spaces between blocks.

#351

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 a sequence of instructions until a specific condition is met.
3. A “do” loop code always starts with an execution (before testing the required conditions) . While in a “while” loop, such a constraint does not exist.
4 .Indentation- write the program code in cleaner and easier manner (optional from programming point of view but practically required.

#352
  1. It allows us to run a piece of code multiple times.
  2. It allows for less errors by allowing a program to repeat some coding. This aids the programmer by having less keystrokes to write, especially if we are programming for a long activity such as number calculation.
  3. A statement starting with the keyword “while” creates a loop. “Do” is similar, however, it must perform once, and, then it will always self-check.
  4. Indentation is when we use indentations in our coding/programming to make our code/program easier to read.
#353
  1. To repeat some statements as many times as we want.
  2. They repeat the statements inside them until the conditions they check is not fulfilled.
  3. The while loop checks the condition at the beginning and the do loop checks the condition at the end.
  4. Indentation is a way to make the structure of the code stand out by introducing different kind of spaces at the beginning of each line.
#354
  1. Looping control flow or a loop allows us to run a piece of code multiple times.
  2. Loops run a piece of code multiple times or until a condition is met: when the value meets one of the conditions, using break and do-loops.
  3. Do-loop is a ‘stubborn’ type of loop - it will keep on repeating until the precise condition is met - such waiting for the user to enter an answer, using a prompt function. Do-loop always wants to know whether it should stop after the first execution, therefore it is not the case with the While loops, that wait for the exact conditions set in advance, and can run indefinitely.
  4. Indentation is a term defining the use of spaces in order to separate different statements and get a grasp of the written code which as a result tends to be written in a more structured way.
#355

1.It allows us to repeat a task without programming every step of it.
2.to repeat a line of code until the condition is false.
3.a while loop will always run until the condition is false. The do part always runs once whether the condition is true or false.
4.identation is several spaces in fronts of statements, like a tab.

#356

What is looping control flow allowing us to do?

Allowing the program to repeat until the program says stop looping. The program will then continue to the next task.

Describe what “loops” do in your own words.

The program continues to repeat until it is told not to do so or until a specific objective is complete.

What is the difference between while and do-loops?

A do loop executes its body at least once, and it starts testing whether it should stop only after that first execution.

What is indentation?

Indentation isn’t required. It is only for aesthetics to make the code stand out.

#357
  1. Looping control flow allowing us to repeat instructions as many times as we need
  2. Loops reapeat the code inside of it as many times as we define them
  3. In do while loops the set of instructions inside of it is executed at least once.
  4. Indentation is a way to show visually the structure of the code, to show blocs of instructions
#358
  1. Allows to go back to some point in the program from before and repeat it with the current program state.
  2. A loop is invoked by the keywords “while” or “do”. A statement, very similar to an “If-Else” statement, is repeatedly executed by the loop, so long as it remains true.
  3. A do-loop will always execute at least once.
  4. It is to make the structure of code stand out. Therefore, making it easier to visualise what the code is doing.