this post was submitted on 17 Mar 2025
1332 points (99.8% liked)

Programmer Humor

34442 readers
276 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] 7 points 1 day ago* (last edited 1 day ago)

for( int i = 0; i < 10; i ++)

This reads as "assign an integer to the variable I and put a 0 in that spot. Do the following code, and once completed add 1 to I. Repeat until I reaches 10."

Int I = 0 initiates I, tells the compiler it's an integer (whole number) and assigns 0 to it all at once.

I ++ can be written a few ways, but they all say "add 1 to I"

I < 10 tells it to stop at 10

For tells it to loop, and starts a block which is what will actually be looping

Edits: A couple of clarifications