mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-02 16:59:18 +00:00
my applications
This commit is contained in:
parent
9cb25e16f9
commit
270cb2e3a2
@ -13,8 +13,6 @@
|
||||
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
println!("Hello and");
|
||||
println!(r#" welcome to... "#);
|
||||
|
||||
@ -5,8 +5,6 @@
|
||||
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
printline!("Hello there!")
|
||||
println!("Hello there!");
|
||||
}
|
||||
|
||||
@ -5,9 +5,7 @@
|
||||
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
x = 5;
|
||||
let x = 5;
|
||||
println!("x has the value {}", x);
|
||||
}
|
||||
|
||||
@ -3,10 +3,8 @@
|
||||
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x;
|
||||
let x = 0;
|
||||
if x == 10 {
|
||||
println!("x is ten!");
|
||||
} else {
|
||||
|
||||
@ -3,9 +3,7 @@
|
||||
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
let x: i32 = 1;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
|
||||
@ -3,10 +3,8 @@
|
||||
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x = 3;
|
||||
let mut x = 3;
|
||||
println!("Number {}", x);
|
||||
x = 5; // don't change this line
|
||||
println!("Number {}", x);
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let number = "T-H-R-E-E"; // don't change this line
|
||||
println!("Spell a Number : {}", number);
|
||||
number = 3; // don't rename this variable
|
||||
let number = 3; // don't rename this variable
|
||||
println!("Number plus two is : {}", number + 2);
|
||||
}
|
||||
|
||||
@ -3,9 +3,7 @@
|
||||
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
const NUMBER = 3;
|
||||
const NUMBER:i32 = 3;
|
||||
fn main() {
|
||||
println!("Number {}", NUMBER);
|
||||
}
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
fn call_me() {
|
||||
println!("Hello World!");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
call_me();
|
||||
|
||||
@ -3,14 +3,15 @@
|
||||
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
call_me(3);
|
||||
call_me(5);
|
||||
}
|
||||
|
||||
fn call_me(num:) {
|
||||
for i in 0..num {
|
||||
fn call_me(num: i32) {
|
||||
let big = if num > 0 { num } else {0};
|
||||
let small = if num < 0 { num } else {0};
|
||||
|
||||
for i in small..big {
|
||||
println!("Ring! Call number {}", i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,12 +5,12 @@
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
call_me();
|
||||
}
|
||||
|
||||
fn call_me(num: u32) {
|
||||
for i in 0..num {
|
||||
println!("Ring! Call number {}", i + 1);
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let age = 15;
|
||||
while true {
|
||||
if age == 15 {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user