Nepedia
Back to Discover
Independent Reader
💻

Control flow

technology Maturity 7-9 Next article →

Computers follow a list of commands to finish a task. This path is called control flow. Usually, the computer goes from one command to the next in a straight line. This is called sequential execution.

Programmingloops
Programmingloops

Sometimes, the computer needs to change its path. It can use a jump. A jump moves the computer to a new spot in the code. Some jumps happen every time. These are called unconditional branches. Other jumps only happen if a rule is met. These are called conditional branches. For example, an if-then statement lets the computer choose a path based on a fact.

A computer can also use a function. A function is a set of code with its own name. When the computer calls a function, it jumps to that code. When the work is done, it returns to where it left off.

Another way to change path is a loop. A loop repeats a set of steps many times. A loop might run for a set number of times. It might also run until a certain rule becomes true. Some loops can even run forever!

Programmingloops
Programmingloops

Loops help computers do the same work over and over very fast.

196 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Programmingloops.svg
Programmingloops.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.