Skip to content · ⁨Pular para o conteúdo⁩

Loops: while, for, and accumulation · ⁨Laços: while, for e acumulação⁩

English

Repeating work

  • A loop runs the same block of code many times, so you don't copy it by hand.
  • C has three loops: while, for, and do-while. They all repeat while a condition is true.
  • The condition is checked each time around. When it becomes false, the loop stops.
Português

Repetindo trabalho

  • Um loop executa o mesmo bloco de código muitas vezes, para que você não precise copiá-lo manualmente.
  • C tem três loops: while, for e do-while. Todos repetem enquanto uma condição for true.
  • A condição é verificada a cada volta. Quando se torna false, o loop para.

Handout · ⁨Material de apoio⁩

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP