Erratum: ======= I'm definitely going to make mistakes as I make these, I'll pin a comment with anything important. If you spot anything not mentioned here, let me know so I can add it! 🙏🏻 Semicolons! -------------------- Something I can not believe I missed, I didn't mention semicolons! 🤦🏻♂ The reason this surprises me so much is that semicolons are an important part of one of my favourite language features, expressions! A line of code in Rust is called a statement, and in Rust there are two types of statements, expressions and declarations. Expressions have a value, declarations set a value. You can combine expressions with both other expressions (building a larger value) or a declaration (its the value that you set in the declaration). Eg, in the declaration `let name = "Daniel"` the expression is "Daniel". This leads to some _really_ cool abilities like being able to return a value from flow control statements like if, match and various loops. We'll cover how expressions interact with flow control in a future episode (either before or after functions, not sure yet). For now, all you need to know is that you need to break statements up with a semicolon`;`.
@astrakernel
5 ай бұрын
Good work, subscribed :)
@FiosQuest
5 ай бұрын
Thank you! ❤️
@RoyaltyInTraining.
5 ай бұрын
I usually like to use my package manager for everything I can, so I don't have to keep track of multiple administration tools. Is there any downside to doing that instead of using rustup? I've been messing around with some stuff after using this installation method, and didn't run into any problems so far.
@FiosQuest
5 ай бұрын
What a great question! I don't think you'll run into any major issues, particularly while learning, use whatever feels right for you. Rust gets a minor update at least once every six weeks so if you want to stay on top and that's the easiest way to do it, you do you! Once you start getting deeper into Rust though, rustup offers some extra functionality that (afaik) you can't get from your distro's package manager. This includes being able to manage different compilation targets and toolchains, manage individual components within the Rust tool suite, easily switch between nightly and stable, pin versions for different projects, etc. I don't think we'll touch any of this in the IRISS series (so long as you can do `cargo test`, `cargo doc`, and `cargo clippy` you should be fine), but if you start doing professional Rust or collaborating with people on complex projects you _might_ need to swap to rustup. If you want to learn more about what Rustup offers and whether you need it, the documentation is a little hidden away but you can find it here: rust-lang.github.io/rustup/
@arunas1
6 ай бұрын
supporting with subs & likes a fellow rustacian ;-)
Пікірлер: 9