moved rust/ to _rust/
parent
ee44275862
commit
7666db24f6
@ -1,36 +0,0 @@
|
||||
// `for` loops/iteration
|
||||
let array = [1, 2, 3];
|
||||
for i in array.iter() {
|
||||
println!("{}", i);
|
||||
}
|
||||
|
||||
// Ranges
|
||||
for i in 0u32..10 {
|
||||
print!("{} ", i);
|
||||
}
|
||||
println!("");
|
||||
// prints `0 1 2 3 4 5 6 7 8 9 `
|
||||
|
||||
// `if`
|
||||
if 1 == 1 {
|
||||
println!("Maths is working!");
|
||||
} else {
|
||||
println!("Oh no...");
|
||||
}
|
||||
|
||||
// `if` as expression
|
||||
let value = if true {
|
||||
"good"
|
||||
} else {
|
||||
"bad"
|
||||
};
|
||||
|
||||
// `while` loop
|
||||
while 1 == 1 {
|
||||
println!("The universe is operating normally.");
|
||||
}
|
||||
|
||||
// Infinite loop
|
||||
loop {
|
||||
println!("Hello!");
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// to install rust:
|
||||
// curl https://sh.rustup.rs -sSf | sh
|
||||
// to compile:
|
||||
// rustc main.rs
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Reference in New Issue