Skip to main content

Cycles

@serverSerrverlesskiy

When an action needs to be repeated a large number of times, cycles are used in programming. For example, you need to display the text πŸ“œ "Hello, World!" 🌎. Instead of repeating the same text output command πŸ“œ two hundred times, a loop is often created that repeats 200 times what is written πŸ–ŠοΈ in the body of the loop. Each repetition is called an iteration.

cycle

Iteration in programming - in the broadest sense - the organization of data processing in which actions are repeated many times, without leading to calls πŸ“ž themselves (as opposed to recursion). In a narrow sense, it is one step in an iterative, cyclical process.

A loop in JavaScript (and in all other languagesπŸ‘…) is a block of codeπŸ“Ÿ that repeats itself as long as a known condition is true. There are many different types of loops, but they all essentially do the same thing: they repeat an action several times.

The while() loop#

While

The while operator creates a loop that executes the specified instruction while the condition being tested is true. The logical value of the condition is calculated вычис before executing the loop body.

Syntax#

Boock

while (condition) {
instruction // algorithm code - instructions
}

Payment#

Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school

Links#

  1. MDN web doc. The article "The do ... while loop"
  2. MDN web doc. For Loop Article
  3. MDN web doc. The while loop
  4. Iteration article, Javascript Express site
  5. While and for Loops
  6. Code for Teens: The Perfect Beginner's Guide to Programming, Volume 1: Javascript - Jeremy Moritz

Contributors ✨#

Thanks goes to these wonderful people (emoji key):


Dmitriy K.

πŸ“–

Dmitriy Vasilev

πŸ’΅

Resoner2005

πŸ› 🎨 πŸ–‹

Navernoss

πŸ–‹ πŸ› 🎨

Become a Patron!