Loops - Reading Assignment

1 Basically it can repeat a function.

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 code. They are usefull when require to do a certain function (task) several times. Like counting from 0 to 100 in even numbers.

3 A do loop will execute code at least once and then looks if it should repeat that code again. A simple while loop will not execute once if the a statement is false.

4 Aesthetics. Sturcturing code in a way that is easier to read for the person viewing it, without changing what the code does.

  1. What is looping control flow allow us to do?Loopingcontrolflowallowsustogobacktosomepointintheprogramwhere we were before and repeat it with our current program state.

  2. Describe what “loops” do in your own words.
    Loops allow us to run a code multiple times until a requirement is met.

  3. What is the difference between while and do-loops?
    In While loop, a 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. 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?
    Intendations are line breaks within the code to make the structure of the code stand out and identify where one block ends and another begins.

  1. To keep repeating 1 or more statements until a condition is met
  2. It loops line(s) of code until a set or computed number is reached
  3. In a while loop the condition is checked before the execution, the do afterwards. This means the do loop get executed at least once
  4. Make the structure of the code stand out through the use of spaces and enters
  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.

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

Loops perform a task over and over again until it is not meeating the criteria to perform again or until it is told to stop.

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

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.

  1. What is indentation?

The need of Indentation : In computer programming , an indent style is a convention governing the indenting of blocks of code to convey program structure. Indentation is used more in languages like C and its descendants, but can be applied to most other programming languages , where whitespace is otherwise insignificant.

  1. It allows us to make control flow come back to the same place over and over until the condition we set up is met
  2. They execute the same code many times
  3. They are very similar except do loop first execute the code and later checks the condition, so it will iterate at least once
  4. It’s a stylistic convention of writing a code, making each block more visible.
  1. automate, reduce the amount of code/work needed - 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. allows us to run a piece of code multiple times
  3. while loops until some condition is met, 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 this indentation inside blocks is to make the structure of the
    code stand out.
  1. What is looping control flow allowing us to do?
    we can do thing multi time with a pieace of short code .
  2. Describe what “loops” do in your own words.
    loops can do thing as much as we want automaticaly .that’s the most powerful thing that computer give us .
  3. What is the difference between while and do-loops?
    do loop always excute it’s body at least one time.
  4. What is indentation?
    indentation is decrease the space in a function or some statement. let the code more readeble.

What is looping control flow allowing us to do?

  • Looping control flow allows us to go back to a previous place in the code and repeat it.

Describe what “loops” do in your own words.

  • By looping we are able to automate the itteration process, and thus get the computer to perform lots of repetitive work.

What is the difference between while and do-loops?

  • While loops first check a condition (i.e. I will do ‘some code’ while ‘B’ is true) then executes code if the condition is true.
	<script>
		
	      var textToDisplay = "Hello!"
	      var a = 8;
	      
	      while(a > 5){
	        document.write("<h2>" + textToDisplay + "</h2>");
	        a--;
	      }
	      
	</script>

- Do loops do first and asks questions later... or ask the conditional while check later.

	<script>

	      var textToDisplay = "Hello!"
	      var a = 8;
	
	      do {
	        document.write("<h2>" + textToDisplay + "</h2>");
	        a--; //decrementing a by 1, a=a-1>
	      } while(a > 5);
  
	</script>

What is indentation?

  • These answers are indented to help show clarity between the Question and the Answer. Your code will also read more easily for you where white space is noth
  1. Looping Control flow allows to run a certain Code multipe times.

  2. Loops is a repetition structured Code which you use as “while” or “do” loops.

3.The difference between “while” and “do” is;
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 codes is your certain strucutre that you should maintain in order to have clear visual set up.
spaces in front of statements that are part of some larger Statement for example and should been Always created with the same spaces.

  1. Looping control flow allows us to repeatedly run the same code a desired number of times.
  2. A loop runs through a section of code multiple times until a condition is met, except a do while loop which will run the code at least 1 time.
  3. A while loop will check the loop condition before running the code however a do-while will run the code and then check the condition before it runs any further times.
  4. Indentation is the physical look and layout of the code to the developer. Spaces and line breaks do not affect how the code is run therefore indentation can be done in a way that makes the code most readable.
  1. What is looping control flow allowing us to do?
    Allowing us to run piece of code multiple times by setting parameters like starting point, condition and increment.
    for (start; condition; increment) {}
    for (var k=0; k<10; k++) {}

  2. Describe what “loops” do in your own words.
    Loops execute piece of code multiple times until set conditions are met.

  3. What is difference between while and do-loops?
    Do loop execute at least once.
    While loop do not start if beginning conditions are not met.

  4. What is indentation?
    Indentation is the method of writing a code which makes it easy to read and easy to make improvements or find errors.

Reading assignment Loops

What is looping control flow allowing us to do?

Looping control flows allow us to go back to a certain point in the program and repeat a process over and over again in a perpetual ongoing cycle. Repeat a process multiply times

Describe what "loops" do in your own words.

Loops is a method used to Repeat a run a process or piece of code multiple times.

What is the difference between while and do-loops?

A do loop with always execute whats in the body at least once so see in it needs to stop after the first execution or continue. The while loop will be continuously until the condition becomes false.

What is indentation?

The indentation is the layout of the code. It’s the line breaks to add structure and make the structure in the code of the program stand out. It is not actually neccacery for add like breaks in the code it can actually be one long string but its much for professional and neat to add indentations.

  1. Looping control flow allows the program to back to the start of a conditional execution with the current program state saved in the memory.
  2. Loops allow the program to compare the current program state to the conditions set for the execution. The program will continue to run until the conditions set by the programmer are met.
  3. The while-loop runs continuously until the condition is false and the do loop will run once whether the condition is true or false.
  4. Indentation is the act of putting a space at the beginning of a line of code to make the structure stand out.
  1. What is looping control flow allowing us to do?
    it allows us to go back to where we were before and repeat it with our current program state.

  2. Describe what “loops” do in your own words.
    i allows you to repeat an execution over and over again with the same variables. so that you dont have write the code everytime.

  3. What is the difference between while and do-loops?
    do loops executes the body once and will starting testing whether it should keep doing it.

  4. What is indentation?
    the spaces between code and line breaks. not necessary but useful to distinguish between code.

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

Looping control flow allows us to go iterate certain piece of the program until the condition is met and the program can continue executing.

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

Loops are conditional statements which allow to repeat certain operation until a given condition is met.

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

The difference is in when the condition gets evaluated: while loop checks the condition first and executes the operation only when the condition is met - it is more cost-efficient this way.

4. What is indentation?

Indentation is an empty space at the beginning of a line to signal the start of a new paragraph, so that code hierarchy make sense and code becomes more readable.

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

It allows a program to go back at certain point and execute that part of the code until it returns a true/false value or is being breaked.

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

They just run piece of code time and time again until some condition is met.

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

Do loops check each time if the condition is met. While loop only checks at the start of the statement and then executes the code

  1. What is indentation?

It’s a space between the code lines. Basically is used so humans can read code easier.

  1. Keep going back into the program to repeat statements using values from the current state.
  2. A loop runs a statement over and over but it uses the new result each time when it runs again. This keeps going until that result reaches a criteria.
  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, even though it doesn’t affect the program, helps the user visually organize the code by adding spaces to blocks.
  1. Looping control flow allows us to go back to a certain point within the program, repeats it for a number of times, until the boolean expression in the control statement produces a false value and stop.

  2. Loops simplify programming by making the computer repeating the execution of a specific part of the code for a specific number of times determined by the programmer. Without loops, the programmer may have to spend much longer time to write much longer repetitive codes which defeats the purpose of programming. In short, loops save time and make the computer doing the heavy lifting with the least amount of code possible.

  3. While loops will repeat the execution of a program (e.g. exponent of a number) for as long as the looping control flows allow - for example: 4 with exponent of 3, the program will execute by multiplying 4 itself for 3 times until it stops.
    image

    As for do-loops, it has the similar control structure as while loops, but it always executes its body at least once. This is because the variable doesn’t have a binding like while loop. It will keep executing over and over again until it gets something that’s not an empty string.

  4. Indentation is the spaces in front of a new line of code in order to show a clear structure of the program. It makes no difference to the execution of the codes, but visually it makes the structure of program to be identifiable by the programmer’s own eyes as well as other programmers’. It makes your life easier!

1.Looping control flow allows us to go back to some point in the program where we were before and repeat it with out current program state.
2 Loops allow us to return and repeat a specific piece of code.
3. A while loop keeps entering a statement as long as the expression produces a value that gives true when converted to boolean.

A do loop always executes its body at least once and it starts testing only after that first execution.
4. The role of indentation inside blocks is only use to make the code stand out.

  1. What is looping control flow allowing us to do?
    It allows us to repeat a piece of code.

  2. Describe what “loops” do in your own words.
    They allow us to repeat a certain task until a certain value is met.

  3. What is the difference between while and do-loops?
    Do loops run at least one time. While loops do not necessarily run one time, because they first check whether a statement is true or false, and if it is false then a piece of program will be run.

  4. What is indentation?
    Adding spaces or tabs in the formatting of the program. It does not affect the program but makes it easier for a human to read. Two spaces is a common format that we will use.