vault backup: 2025-02-17 16:15:54

This commit is contained in:
Dane Sabo 2025-02-17 16:15:54 -05:00
parent 389dc210cd
commit f29d3f1789
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# First things first
Chapter 1 takes you through an introduction to rustc -- an older version of compiling and running rust that predates Cargo. The first thing I did was create a 'Hello, world!' program.
I also learned that when naming files, the convention is underscores:
**Good**:
hello_world.rs
**Bad**:
helloworld.rs
# What does a Rust program look like?
Here was our full hello world program:
```rust
fn main() {
println!("Hello, world!");
}
```
First, there's the fn main() function. This is always the first piece of code that will run in a Rust program.
Second, indents always happen with 4 spaces, not a tab.
Third, the print statement is doing something a little different. It is a *macro*, not a function. Macros use ! at the end, while functions do not.
Fourth, each line ends with a semicolon. Much like C.

View File

@ -0,0 +1,6 @@
[package]
name = "hello_cargo"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}