Loops - Reading Assignment

#303

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 repeat a statement as long as a certain criteria 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.

What is indentation?

  • Added spaces in front of statements that are part of some larger statement.
0 Likes

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

It allows us to go back to some point in the program where we were before and then repeat elsewhere in the program as many times as we want using simple shortcuts.

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

It’s a form of a shortcut or codehack that allows us to make a function run over and run as far as we want it to using simple commands. It’s like if we want the sum of all the numbers from 1 through 1000, we don’t have to add up the whole thing. We just need to input some code that tells the program what we want it to do without writing it all out manually.

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

while(expression){statement}
^The loop will keep entering that statement as long as the boolean value of the expression is true

A do-loop is like a while loop, but it always do it once before asking again.

  1. What is indentation?

They are meant to making the code easier to read.

0 Likes

#305
  1. to go back to some point in the program where
    we were before and repeat it with our current program state.
  2. Loops are a bit of code that keep repeating them self’s
  3. The difference between them is when the condition gets evaluated.
    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.
0 Likes

#306
  1. What is looping control flow allowing us to do?
    It allows us to repeat a section of code until a certain condition is met.

  2. Describe what “loops” do in your own words.
    Loops provide a way to repeat the same expressions until a certain condition is met.

  3. What is the difference between while and do-loops?
    Fundamentally, they are the same. With the DO, the expression is executed before it checks the condition (the first time).

  4. What is indentation?
    Makes code more presentable and easier to follow the logic.

0 Likes

#307
  1. Looping control flow is allowing us to go back to a point in the program while in its current state and repeat the action in the loop.
  2. Loops allow us to repeat a segment of code multiple times for a more efficient program.
  3. the difference between while and do-loops is that a do-loop happens at least once.
  4. Iteration is the amount of times that a loop is repeated.
0 Likes

#308
  1. To go back to some point in the program where we were before and repeat it with our current program state.
  2. Loop is a block of commands that can be re-executed until the condition is met.
  3. Do loop always executes its body at least once, and it starts testing whether it should stop only after that first execution.
  4. Spaces and linebackers in the code. Recommended for order, so it will be convenient to read the code
0 Likes

#309
  1. What is looping control flow allowing us to do?
  • Looping control flow allows us to run a particular piece of code multiple times, so as to repeat a statement using a current, and modified, state.
  1. Describe what “loops” do in your own words:
  • Loops are a kind of control flow that allows a piece of code to be repeated multiple times in order to achieve a particular purpose.
  1. What is the difference between while and do-loops?
  • while loops are control flow statements allowing code to be repeatedly executed according to a (boolean) condition, and do-loops allow a piece of code to be run at leat ice, and then possibly repeatedly executed depending on whether or not a boolean condition if fulfilled by the first iteration.
  1. What is indentation?
  • indentations are spaces used to emphasise the structure of code when reading and writing. It does not affect the running of a piece of code, but makes it easier to read.
0 Likes

#310
  1. Looping control flow allows us to go back to a specific point we were in in the program to repeat it with our current state.

  2. Loops allow you to program a repetitive action that executes, progresses and stops based on the values you’ve input. In simpler terms, loops run a piece of code multiple times.

  3. Do-loops always execute the body at least once, and it starts testing whether it should stop only after the first execution. Besides this, there are no other differences between while and do loops.

  4. Indentation is a method used to properly organize one’s code, identifying blocks, thus making it easier to read.

0 Likes

#311
  1. What is looping control flow allowing us to do?
    Preform the same action multiple times with little effort.

  2. Describe what “loops” do in your own words.
    Loops preform actions till a final outcome is found. Loops can contain if statements and be simple counters or preform complicated functions.

  3. What is the difference between while and do-loops?
    Do loop must execute at least 1 time. While executes based on it’s predefined requirements.

  4. What is indentation?

It is the use of tab to create parent and child processes visually to make code easier to read.

0 Likes

#312
  1. What is looping control flow allowing us to do?
    Create a program and run through it. After the program is finished running, it goes back to the top and start over again on the same program. This allow us to run a program on autopilot until some conditions are met that breaks the loop.

  2. Describe what “loops” do in your own words.
    Create a program and run through it. After the program is finished running, it goes back to the top and start over again on the same program. This allow us to run a program on autopilot until some conditions are met that breaks the loop.

  3. What is the difference between while and do-loops?
    While loops use 7 lines of code and for loops uses 4 lines of code. They do the same thing. They check the condition and see if it is true or false. If it`s true, then they will increase or decrease the value and start the loop over again. A do loop always executes its body at least once, and it starts testing whether it should stop only after that first execution. So the difference being that in the do loop you first check the body of the loop, then check if the condition is true. In the while loop you first check the condition, then check the body of the loop.

While Loop:
Int i;
i = 3;
while(i>10) {
print (i);
i++;
}

For Loop:
For(I = 3; I > 0; i++) {
Print (i);
}

Do Loop:
Int I = 0;
do {
Print (i);
i ++;
} while (i > 0);
}

  1. What is indentation?
    When opening a block and closing it we want to use indentation to show where one block/program end and where the next one starts. This is to better get a visual picture and better overview of the coding. It can get messy quick so we use spaces to differentiate the statements etc.
0 Likes

#313
  1. Looping control flow lets us go back to a point in the programme and repeat an action with it’s current state.

  2. It’s the repeat of a given action until a certain criteria is met. For example if we wrote a loop to count to 10 we may ask it to add 1 to the the current value until the value 10 is reached.

  3. While loops checks the current condition and then executes it’s action, do loops execute their action before checking the current state.

  4. indentation is the structure of spaces and lines in code in order for a human to read it more easily. Computeres don’t care about the arrangment of the code only that it is written in a certain order.

0 Likes

#314

1. What is looping control flow allowing us to do?
Loops allow us to run a piece of code multiple times, going back to some point where we were before and repeat it with our current program state
2. Describe what “loops” do in your own words.
Loops repeat an action several time, using the newly created outputs from the program. So the program will take X, apply a function to it to create Y, then take Y and apply the same function to create Z and repeat that until the defined boundary. The boundary is found by the program when the output created can be converted to true when compared to the expression in parentheses in the while expression, or when the break condition is found. Loops are a JS native feature that are triggered with the keyword “while”.
3. What is the difference between while and do-loops?
Both while and do will trigger a JS Loop for your program. However, do will always execute its designed function once before checking whether the conditions are met to stop executing the loop. While will check right away.
4. What is indentation?
It is the addition of spaces or tabulations in front of lines of codes, inside of statements for example. While they are optional, they are a good way to make the structure of the code standout.

0 Likes

#315
  • 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 allow a segment of code to be repeated (without duplicating the code) while a certain condition holds true

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

While loops check the conditional statement before execution and do-loops execute once prior to checking the condition

  • What is indentation?

Spacing that allows blocks of code blocks to be visually grouped together. This makes maintenance and understandability easier.

0 Likes

#316

1- Looping control flow allows us to repeat a piece of code multiple times until we reach the desired result.
2- Loops repeat some code execution as long as a condition is met, One interesting thing with loops is the possibility of modifying a variable each time the code repeats itself.
3- To be honest, I didn’t quite understand the do loop and how it differs from the while loop. Maybe the writer was trying to say that, even if the first result of the while loop turns out to be false, the program will run at least once before stopping.
4- Indentation is the usage of space and line breaks in between statements, to make it easier to work with the code.

0 Likes

#317

1. What is looping control flow allowing us to do?
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. Describe what “loops” do in your own words.
Loops continually run a block of code until certain conditions are met

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

while loops - test expression is checked first
do loops - code is executed at first and then the condition is checked

4. What is indentation?
Indentation is optional spaces in the beginning of lines of code. It is not compulsory, however is recommended for code readability.

0 Likes

#318

What is looping control flow allowing us to do?

  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.

Describe what “loops” do in your own words.

  1. Loops are used to execute the same block of code a specified number of times or while a specified condition is true. Very often when you write code, you want the same block of code to run over and over again in a row. JavaScript offers several options to repeatedly run a block of code, by using conditional (if,else, and switch) and looping (while,do, and for)statements.

What is the difference between while and do-loops?

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

What is indentation?

  1. These spaces are not required—the computer will accept the program just fine without them. In fact, even the line breaks in programs are optional. You could write a program as a single long line if you felt like it. 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.
0 Likes

#319
  1. Looping control allows us to decrease the amount of written code, making it more succinct, by repetitive execution of a certain function.
  2. Loops are functions that run a piece of code until certain conditions are met, or the loop is being stopped.
  3. while loop - condition is being checked first;
    do loop - code is being executed first and then the condition is checked.
  4. Indentation is used in order to make code strings look more organised and readable for humans. Machine doesn’t care about it.
0 Likes

#320
  1. What is looping control flow allowing us to do?
    It allows us to execute a code multiple times until a condition is met.
  2. Describe what “loops” do in your own words.
    Loops defines a variable, checks if it meats a certain condition, and applies code on it. It goes back to start of the loop and executes the second iteration based on the result of the latest loop.
  3. What is the difference between while and do-loops?
    Do loops executes the code at least once before checking if the condition is met.
  4. What is indentation?
    It is structuring the code visually to make it easier to understand.
0 Likes

#321
  1. What is looping control flow allowing us to do?
    “It allows us to go back to some point in the program where we were before and repeat it with our current program state” ref: from the book, chap 2

  2. Describe what “loops” do in your own words.
    Loops save us the work ( and time ) to write manually one by one, the code that might concern a program that counts or any other similar program where an important amount of values are necessary to code for the computer to execute the program.

  3. What is the difference between while and do-loops?
    a do-loops always executes its body at least once and it starts testing whether it should stop only after the first execution.

  4. What is indentation?
    Indentation is when the code is presented in proper and structured blocks, easy to read and identify for human programmers.

0 Likes

#322
  1. Looping control flow allows us to go back to some point in the program where we were before and repeat it.
  2. Loops in Js allows us to write a code that will repeat himself set number of times until process is complete.
    3.The difference between do and while is that do evaluates its expression at the bottom of the loop instead of the top. Therefore, the statements within the do block are always executed at least once.
  3. Indentation makes the program code cleaner and easier to read.

With proper indentation, the visual shape of a program corresponds to the shape of the blocks inside it, recommended to use 2 spaces for indentation of code blocks.

0 Likes