use loops to print-patterns

Why use loops?

  • In order to know why we use looping in programming, we will first, be aware that different programming languages have different for loops. In Python, for instance, you can iterate through all the items in a list by writing.

  • Loops are used in programming as a test to know if the arguments in a clause are true or false and then determine to do an action that may involve skipping the clause and going to the next one.

  • There are many different types of looping. If your loop only needs a test to decide if it should keep looping or not, then a do-while fits that.

Different Kinds of Loops

Distinct programming Languages such as “JavaScript, Python,C,Java & moar…” supports different kinds of loops:

  • for - loops through a block of code a number of times.

  • for/in - loops through the properties of an object.

  • for/of - loops through the values of an iterable object.

  • foreach- loops through the iterable object checking its properties/values.

  • while - loops through a block of code while a specified condition is true.

  • do/while - also loops through a block of code while a specified condition is true


RAW CONTENT URL