Text description (for those with screenreaders):

A portion of a prime number checker written in the Rust programming language, where the first few lines are written correctly including the first if statement in the program. However, the following if statements are written using Python syntax instead of Rust, as the author slipped back into his native tongue.

  • Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    arrow-up
    0
    ·
    10 months ago

    I get this switching between Kotlin and Rust, and Java and C#. Close enough to be confusing, but distinct enough that I end up looking up the right syntax.

    Would recommend setting up VS Code or RustRover (while it’s still in EAP and free). Rust’s error messages are nice and all but it’s better to see the warnings before you hit compile.

    FYI the Rust compiler will try to be smart and defect tail call recursion, but if you want to be sure your code is fast, you should probably turn that recursion into a loop.

    • JustARegularNerd@aussie.zoneOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      10 months ago

      I was pleasantly surprised by how good the error messages are in Rust though on compile time. I agree that having an IDE flag them before I compile is much better though.