this post was submitted on 17 Mar 2025
1358 points (99.7% liked)

Programmer Humor

34442 readers
155 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 2 days ago* (last edited 2 days ago)

It’s a For Loop.

Imagine you want something to repeat a certain number of times, or run while a certain variable is set to a specific number.

It starts by setting i = 0. Then it says “while i is less than 10, run.” Then it says “Every time you run, increment i by 1. So it sets i to 0, runs once, sets i to 1, runs again, sets i to 2, etc… And it does this until i is 10, at which point it will stop because i is no longer less than 10.

The actual code you want to run each time i is less than 10 would go below this function.

It’s a pretty basic way to tell a program “do this thing [x] times and then move on.” It’s like coding 101, which is why it’s funny that the person claimed they knew everything except for that part.