• OshaqHennessey@midwest.social
    link
    fedilink
    arrow-up
    0
    ·
    1 day ago

    Shit, you’re right. x is declared inside the loop, so it doesn’t exist until the loop begins execution.

    Technically, I suppose you could say the compiler will allocate memory for x without assigning a value before the loop is executed and… I’m understanding what you mean now, I think.

    • anton@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      0
      ·
      24 hours ago

      The code seems to be C-style language with curly braces and types in front for variable declarations, probably java. This means the variable must be declared of screen before the loop or it would not compile. It could have a previous value or be uninitialized, but that does not affect the end result.