Rustlings: Live!
Review edition
Oh the topics we've covered
-
Variables and Mutability
-
Data Types
-
Functions
-
Conditionals/Control Flow
-
Ownership Model
-
Structs
-
Enums
-
Optional + Result
-
Generics + Traits
Variables and Mutability
Data Types
Type | Example Values |
---|---|
bool | true/false |
char | ❤️, a, 東京 |
i8, i16, i32, i64, isize | -5, 42, |
u8, u16, u32, u64, usize | 5, 42 |
f32, f64 | 3.14, 4,5 |
array | let array: [i32; 5] = [0, 1, 2, 3, 4]; |
slice | let slice = &array[0..3]; |
str | "Hello World" |
tuple | let tuple = ("hello", 42, "world", [3,6,9]); |
Functions
Control Flow
Ownership
Structs
Structs
Enums
Optional + Result
Optional + Result
Generics + Traits
Problem Set
Determine if a triangle is equilateral, isosceles, or scalene.
An equilateral triangle has all three sides the same length.
An isosceles triangle has at least two sides the same length. (It is sometimes specified as having exactly two sides the same length, but for the purposes of this exercise we'll say at least two.)
A scalene triangle has all sides of different lengths.
Problem Set
Review!
By shortdiv
Review!
- 720