• JustAnotherKay@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    23 hours 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