Loops - Reading Assignment

  1. What is looping control flow allowing us to do?
    allows us to repeat the same process over and over with less work
  2. Describe what “loops” do in your own words.
    while a certain condition evaluates to true, the loop of code repeats itself
  3. What is the difference between while and do-loops?
    do loops always executes its body at least one, the condition comes after the statement. while loops may not execute once if the initial condition is not met
    DO:
    let number = 0;
    while (number <= 12) {
    console.log(number);
    number = number + 2;
    }
    // → 0
    // → 2
    // … etcetera

WHILE:
let yourName;
do {
yourName = prompt(“Who are you?”);
} while (!yourName);
console.log(yourName);

  1. What is indentation?
    your IDE will automatically make spaces with each new block of code. This is not necessary but helps to make the blocks stand out.
  1. What is looping control flow allowing us to do?
    -Allows us to go back to parts of the program and repeat it with the current state of the program.

  2. Describe what “loops” do in your own words.
    -A easier way to run certain lines of code multiple times in a program.

  3. What is the difference between while and do-loops?
    While Loops - Creates a loop with the keyword “while” in a statement followed by a parentheses and then a statement

Do-Loops - Similar to a while loop but it executes the body at least once and it checks itself after.

  1. What is indentation?
    Indentation is a way to make your code look cleaner and structural giving it spaces between blocks.
  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. Loop will unable us to run the code multiple times and by doing that - will save us time.
  3. A “do” loop is a control structure similar to a “while” loop. it differs only on one point . a “do” loop 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 in front of statements that are part of some larger statements.
  1. It allows us to execute a certain part of code over and over again.
  2. They keep running a certain part of the code infinitely or until a condition has been met which will break out of the loop and continue with the rest of the code.
  3. A while loop runs the code until it meets the requirements. A do loop runs until it gets a correct input.
  4. Indentation are used to make the code look nice and easier to understand.

What is looping control flow allowing us to do?
Looping control flow allows us to go back to some point in our program and repeat while maintaining the program state.

Describe what “loops” do in your own words.
Loops repeat blocks of code until a condition or statement is met.

What is the difference between while and do-loops?
A Do loop always executes its body at least once, then begins testing the condition.

What is indentation?
Indentation allows the structure of the code to stand out in a meaningful way.

  1. What is looping control flow allowing us to do?
    Be able to repeat several steps where something can be added, multiplied or queried and processed.

  2. Describe what “loops” do in your own words.
    A loop runs some program steps defined by a teller or other trigger. So long a specific value is not reached it will repeat some task.

  3. What is the difference between while and do-loops?
    while loops are repeated so long a value has not reached a specific value. Do loopes will be exucted ones.

  4. What is indentation?
    The spaces on the code lines which makes the code more easy to read.

  1. What is looping control flow allowing us to do?
    This is the process in which a programs logic steps can be lain out in any way that suites the programmer. It allows for the possibility of a program to interact with input values in any sequence a coder can think of.

  2. Describe what “loops” do in your own words.
    A loop is a logic trap that will repeat a process indefinitely until a condition is met to exit the loop from a pre set parameter, or from a direct command that executes somewhere during the looping process.

  3. What is the difference between while and do-loops?
    A while loop may not even execute a single expression if the input value does not meet the conditions stipulate for the loop to execute. A do loop on the other will always execute its underlying program at least once before it runs an evolution on whether or not to continue the loop based on the output value returned from the initial execution.

  4. What is indentation?
    This is simply a convention used my all programmers to allow ease of interoperability with code that may be passed around to a group or a number of different coders. Most programs like atom create the proper convention of indentations somewhat automatically based on what it thinks you are doing, but you can manually indent to create the structure you like best also.

  1. Looping control flow allows us to automatically repeat a piece of code over a certain period of time or until it produces a true value.

  2. “Loops” reuse code by inputting previous outputs which have been updated by the parameters of the while, do, and for functions.

  3. A while loop usually requires an input to execute, but a do loop always executes its body at least once.

  4. Indentation is the general consensus for accepted code structure to make it easier to read someone else’s code.

What is looping control flow allowing us to do?
It allow us to repeat(or apply) an operation multiple time based some defined condition.

Describe what “loops” do in your own words.
Its allow us to reuse a code block multiple time, based on a conditional statement.
It will define a point in the code where the execution loop back until a condition gets evaluated to false.

What is the difference between while and do-loops?
A while loop as its condition defined before the loop start, a do loop as it after.
A do loop will always execute at least once, A while loop only execute if condition is respected

What is indentation?
Indentation is placing X number of space in front of statement that are nested inside other statement so that the context and order of execution is more obvious. It is not mandatory for the code to exec but is a convention to make code more human readable.

  1. Looping control flow allowing us to go back to some program we were before and repeat it with our current program state.

  2. “Loops” are writing a piece of code multiple times.

  3. The difference between while and do-loops are while-loops keep entering a statement as long as the expression produces a value that gives true when converted to Boolean and do-loops always execute its body at least once, and it starts testing whether it should stop only after that first execution.

  4. Indentations help the structure of a code stand out.

What is looping control flow allowing us to do?

Run the code multiple times until a condition is met

Describe what “loops” do in your own words.

Loops compare the result of a calculation to a defined desired outcome, if they don’t match it will run the code again until it meets the criteria.

What is the difference between while and do-loops?

A do loop will only assess if it has completed its task after it has run its calculation at least once. While loops do not have this.

What is indentation?

It is visual structure added to code for the sake of readability to the coder. Indentation and line breaks are null when the code is being run.

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.

Loops repeatedly execute a function given a set of parameters, as soon as these are met the loop ends and the function ceases to execute. It allows many iterations of a program without having to input all the commands over and over again .

What is the difference between while and do-loops?

‘While Loops’ are ‘regular’ loops that technically could be fulfilled in their first iteration, and therefore provide no output. ‘Do Loops’ are a loop that must execute its body at least once, and it starts testing whether it should stop only after that first execution.

What is indentation?

Indentations is spaces in the beginning of lines of code to make the structure stand out. It is not necessary and only used for readability.

  1. What is looping control flow allowing us to do?
    A way to run a piece of code multiple times. This form of control flow is called a loop. 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. If we combine this with a binding that counts, we can do something like this:
    let number = 0;
    while (number <= 12) {
    console.log(number);
    number = number + 2; }
    // → 0 // → 2 // … etcetera

  2. As an example that actually does something useful, we can now write a program that calculates and shows the value of 210 (2 to the 10th power). We use two bindings: one to keep track of our result and one to count how often we have multiplied this result by 2. The loop tests whether the second binding has reached 10 yet and, if not, updates both bindings.

let result = 1;
let counter = 0;
while (counter < 10) { result = result * 2; counter = counter + 1; }
console.log(result); // → 1024
The counter could also have started at 1 and checked for <= 10, but for reasons that will become apparent in Chapter 4, it is a good idea to get used to counting from 0. 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. To reflect this, the test appears after the body of the loop. let yourName; do { yourName = prompt(“Who are you?”); } while (!yourName); console.log(yourName); This program will force you to enter a name. It will ask again and again until it gets something that is not an empty string. Applying the ! operator will convert a value to Boolean type before negating it, and all strings except “” convert to true. This means the loop continues going round until you provide a non-empty name.

  1. Describe what “loops” do in your own words.
    In most computer programming languages, a do while loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given boolean condition at the end of the block. The do while construct consists of a process symbol and a condition.
    In computer science, a for-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly. … For-loops are typically used when the number of iterations is known before entering the loop.

  2. What is the difference between while and do-loops?
    In While loop, condition is tested at the beginning of the loop and if the condition is True then only statements inside the loop will be executed. So, While loop executes the code block only if the condition is True.
    In Do While loop, condition is tested at the end of the loop so, Do While executes the statements in the code block at least once even if the condition Fails. Please refer Do While loop for further reference.

  3. What is indentation?
    Adding spaces in front of statements that are part of some larger statement 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. I like to use two spaces for every open block, but tastes differ—some people use four spaces, and some people use tab characters. The important thing is that each new block adds the same amount of space.

if (false != true) {
console.log(“That makes sense.”);
if (1 < 2) {
console.log(“No surprise there.”);
}
}

Most code editor programs will help by automatically indenting new lines the proper amount.

  1. What is looping control flow allowing us to do?
    allows the program to go back to the start of a conditional execution with the current program state saved in the memory

  2. Describe what “loops” do in your own words.
    Repeating several steps and be able to step out a specific moment.

  3. What is the difference between while and do-loops?
    While will do some things so long a value is true.
    Do loops until it gets any valid input

  4. What is indentation?
    An ammount of spacing on the beginning of every lines to make your code more readable

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

To do many instances of the instructions, by going back to the beginning with updated data until it will end.

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.

Enable repeating code.

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

While loop will be exectude when coditions are met, do loop exectue at least once, then it is checking the conditions.

  1. What is indentation?

It is adding space before statements.

  1. Allows us to repeat some piece of code multiple times, based on some conditions( while (a < 5) { doSomething(); })
  2. Executes piece of code multiple times, can execute it with different values and as many times as we want based on some condition
  3. while checks condition before executing the code(if value is false from the beginning there will not be a single iteration), do loop checks condition after executing the code( so one iteration is guaranteed)
  4. Indentation is a use of tabulation and/or spaces to make code human readable. So we can understand what code is nested and what values assigned to what variables and what parts of code are connected and what is not.
  1. Looping control flow is allowing us to to repeat some instructions automatically until the condition is reached and without retyping every line.

  2. Loops, is a function which is used for repeating some instructions without retyping every line. By this, it´s possible to let the program repeat the instruction until the statement is true and the loop can be exit.

  3. The difference between while and do-loops is that a while-loop first checks the condition and if it´s true the program will be executed. The Do-loop will first run the program and than will check the condition afterwards.
    for example number <12

  • while loop stops at 11
  • do loop stops at 12.
  1. An indentation is a way of writing the code. Simple adding spaces if a new instruction starts and keep this instruction i one row, this way it´s more readable.
  1. Goes back to a previous part of the programme and repeats it at the current point in the program.
  2. Running a piece of code continually to perform the same function.
  3. With a while loop the programme checks whether it needs to continue at the beginning of every repetition. A do loop executes its body at least once and only checks after it’s first execution.
  4. Indentation is adding indentations before a new line of code. This does not effect the execution of the code but makes it easier to read for human beings.

1 What is looping control flow allowing us to do?
Loop control flow allows us to go back to some point in a program and repeat a state.

2 Describe what “loops” do in your own words.
Loops will repeatedly execute a part of a program until a condition is met.

3 What is the difference between while and do-loops?
The difference between a DO loop and a WHILE loop is that a DO loop will execute only once then tests whether it should stop after that first execution…eg. a function that prompts for a name could ask “who are you” repeatedly until a string value is entered.

WHILE loop will continually execute until a condition is met… eg. while a<5 console.log (hi)

4 What is indentation?
Indentation is the format in which we write code. Code needs to be easily readable and so breaking up codes into lines, paragraphs and indentation helps with readability. Similar to writing a book, you wouldn’t just write a book in one straight line or without sentences, paragraphs and punctuation full stops etc as it would not be readable.

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 repeating some piece of code as long a given / required condition is fulfilled.
3. While loops The keeps entering astatement as long as the expression produces a
value that gives true when converted to Boolean
Do loops 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. The role of indentation inside blocks is to make the structure of the
code stand out.