• anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    1
    ·
    3 个月前

    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.

    • BassTurd@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      3 个月前

      I read in on C but it’s also true for JavaScript. The code implies that x was declared as an int sometime previously, or if JavaScript, just an object if not assigned a value giving it a type.

    • OshaqHennessey@midwest.social
      link
      fedilink
      arrow-up
      1
      ·
      3 个月前

      Yeah, it does look like C now that I think about it. You’re right about the end result too. I believe C# will let you do inline declaration and assignment like that, so maybe that’s what we’re looking at? Been a while, could be wrong