Loops - Reading Assignment

  1. It allows us to run a piece of code multiple times.

  2. Loops repeat a task until a certain condition is met.

  3. A while loop first checks if a condition is true or false, a do loop will run the code at least once and then checks if condition is true or false.

  4. Indentation is like interpunction for code, it makes it easier to read the code.

2 Likes

Q1: Looping allows us to go back to some point in the program we were before and repeat a certain task if a condition is met if not it will by bypass that task based on the conditions we assign.

Q2: Loops in my own words would be the way we can avoid having to do repeatable tasks by programming the computer to do it for us until a certain condition is met then it either stops right there or continues with the next tasks we give it.

Q3: A while loop will check if a condition is true or false and then execute the program based on the condition set; a do loop will first execute the program and it will continue to execute that same program until it verifies the conditions have been met.

Q4: indentations are spaces used to help us structure the code and make it easier for us to read as a computer does not read the white space.

1 Like
  1. Looping control flow allows us to write repetitive operations compactly.
  2. A loop repeats the same set of instructions until some condition is met.
  3. A while loop checks the condition at the beginning, a do loop checks it at the end of the loop.
  4. Indentation refers to the white space on the left of commands. It is good practice to indent the code inside loops so that the structure is visually clear.
1 Like
  1. What is looping control flow allowing us to do?

It allows us to repeat the instructions in a control flow.

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

A loop executes a statement(s) in a program, then updates the state of the program and compares that updated state with specified parameters. If the value of the state within these parameters holds true, the loop will execute the statement again. It will do this until the parameters produce a value that is false.

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

While loops will check the parameters first - if the value is true they will execute the code. Do loops execute the code first (once) and then check the parameters.

  1. What is an indentation?

Indentations are spacings within written code to make the code more readable. It is a personal thing and there are no rules.

1 Like
  • What is looping control flow allowing us to do?
  1. It allows one to go back to some point in the program at a point before and repeat it with our current program state.
  • Describe what “loops” do in your own words.
  1. Loops are a more efficient way to write out and run pieces of code multiple times. Less work and time writing out outputs.
    —>—>o—>—>
    O
  • What is the difference between while and do-loops?
  1. (While) Loops keep entering that statement as long as the expression produces a value that gives true when converted to Boolean. (Do) Loops always executes its body at least once, and it starts testing whether it should stop only after that first execution.
  • What is indentation?
  1. Spaces in front statements in most lines of code That are part of same larger statements. It is optional as well as line breaks, but helps 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 until the requirement is met and then it exits or let program proceed ahead.

  2. They repeat a certain statement until condition given is satisfied

  3. Do loop will be executed at least once but while loop will check the condition first and then it may or may not get executed depending on the condition.

  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. What is looping control flow allowing us to do?

Looping control flow allows us to repeat a code multiple times until the test expression no longer returns a true result.

2. Describe what "loops" do in your own words.

loops allow us to program code that executes itself continuously until some pre-condition is met.

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

“do-loops” always executes its body at least once, and it starts testing whether it should stop only after that first execution. In opposite, the “while loops” checks before execution.

4. What is indentation?

The role of this indentation inside blocks is to make the structure of the code stand out.
With proper indentation, adding standard spaces in our code, the visual shape of a program corresponds to the shape of the blocks inside it, making it easier for to someone read and understand the code.

2 Likes

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.

It speed up de programming proces for the programmer. If you would not have loops you would have endless coding to do.

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

A do loop will always be executed a first time. It will stop when the value ‘true’ is reached. The While loop will continue as long the expression gives the value ‘true’ when converting to boolean.

4 What is indentation?

You use identation to keep track on programming. It gives lay-out to the structure of programming. It is not important for the program itself.

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.
Loops repeats an action a number of times
• 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.
The while loop uses the word while is followed by an expression in parentheses and then a statement, much like if. The loop keeps entering that statement as long as the expression produces a value that gives true when converted to Boolean.

• 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
  • What is looping control flow allowing us to do?
    It allows us to go to some point in the program where
    we were before and repeat it with our current program state.

2020-05-29_15h28_46

  • Describe what “loops” do in your own words.
    Can I say that it is a shortcut to less work?
    So the code that I am running up :arrow_up: is a shortcut to counting.

  • What is the difference between while and do-loops?
    ‘While’ creates a loop. Then an expression (number) followed by a statement (<=12)
    while (number <= 12)

  • What is indentation?
    I think a structure to make code stand out by telling the begin and end. In Grammar we have that with a CAPITAL starting a sentence and ending the sentence with a DOT.

1 Like
  1. Go back to previous point and repeat the task
  2. Loops are repeating a certain piece of code until the condition is achieved.
  3. while loops run until they reach a a predefnied value whereas do loops run until they reach a valid input
  4. It’s an optional space that makes the code look more structured
1 Like
  • What is looping control flow allowing us to do?
    Looping allows us to condense the code using logic, by replacing statements with conditional execution.

  • Describe what “loops” do in your own words.
    Loops execute a statement continuously, returning values until a condition is met.

  • What is the difference between while and do-loops?
    A do loop differs from a while loop by the do loop executing its contents at least once before checking any conditions.

  • What is indentation?
    indentation is a way to visually organize code text and doesn’t affect the function of the code.

1 Like
  1. It allows us to run a code multiple times without having to always do each step from the beginning.

  2. Loops continuously run until a certain outcome is met and can be discontinued by the “break;” control signifying end of loop.

  3. While loops examine and evaluates a condition before executing it. Do loops will run at-least once then evaluates the condition.

  4. It’s a way of making the code structure easy to see, being able to differentiate where new blocks are open, sometimes in other blocks, and where each block ends and begins.

1 Like
  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 are used in order to repeat particular action in our code.

  3. What is the difference between while and do-loops?
    While-loops can continue forever, do-loops execute operation just once.

  4. What is indentation?
    It is space between different blocks of code used in order to make code more readable for us- this action does not affect the computer processing.

1 Like

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 allow us to complete repetitive sequential tasks very quickly (once we have it set up correctly).

3. What is the difference between while and do loops?
While and do loops are very similar. The difference is that a do loop always executes its body at least once, and it starts testing whether it should stop only after that first execution.

4. What is indentation?
Proper indentation provides visual shape to a program that corresponds to the shape of the informational blocks inside it.

1 Like

Hi @LXSO,

Q1, 2 & 4 :ok_hand:

No… both can potentially get stuck in an infinite loop if their conditions are set so that they never evaluate to false. Instead, the difference is the following:

While loops start by evaluating the condition before executing their code block for the first time. This means that, if the condition is not met on the 1st iteration, the loop will be exited immediately and its code block never executed.
In contrast, the conditional expression in do loops is placed after the code block. This means that the code block will always be executed at least once before the loop is exited.

I hope that clarifies things.

1 Like

Hi @jon_m , yes now that makes more sense, thank you very much for help :slight_smile:

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. A loop is a piece of code that allows parts of the code to be repeated until the underlying base case is being met.

  3. A while-loop first checks wether a statement is true or false, and meanwhile, a do-loop has to run at least one time.

  4. Indentation is the way the code is structured. Good indentation makes it clear and easier to see the different blocks of code, rather than it all being written in one line for an example.

1 Like

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.
It allows you to run a piece of code over and over again for as long as the condition it should repeat is met.

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

4. What is indentation?
Spaces in front of statements. The role is to make the structure of the code stand out. The visual shape of a program corresponds to the shape of the blocks inside it.

1 Like

What is looping control flow allowing us to do?
It allow us to run a piece of code multiple times
Describe what “loops” do in your own words.
It means the code will run as long as the condition is met.
What is the difference between while and do-loops?
In while loop the code will execute as long as the condition is met and will not run if the condition is not met but in do loop the code will run atleast once.

What is indentation?
Idententation are the spaces and breaks inside the program to create a better structure for the reader to understand the code easier.

1 Like