-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
789ff7c
commit fab81b8
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fn main() { | ||
let condition = false; | ||
|
||
let number = if condition { 5 } else { 4 }; | ||
|
||
if number % 4 == 0 { | ||
println!("number is divisible by 4"); | ||
} else if number % 3 == 0 { | ||
println!("number is divisible by 3"); | ||
} else if number % 2 == 0 { | ||
println!("number is divisible by 2"); | ||
} else { | ||
println!("number is not divisible by 4, 3 or 2"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
fn main() { | ||
println!("----Start----"); | ||
let mut counter = 0; | ||
let result = loop { | ||
counter += 1; | ||
println!("counter is {counter}"); | ||
if counter == 10 { | ||
break counter * 2; | ||
} | ||
}; | ||
println!("The result is {result}"); | ||
|
||
let mut count = 0; | ||
'counting_up: loop { | ||
println!("Count: {count}"); | ||
let mut remaining = 10; | ||
|
||
loop { | ||
println!("Remaining: {remaining}"); | ||
if remaining == 9 { | ||
break; | ||
} | ||
if count == 2 { | ||
break 'counting_up; | ||
} | ||
remaining -= 1; | ||
} | ||
count += 1; | ||
} | ||
|
||
while count != 0 { | ||
println!("Not zero yet"); | ||
count -= 1; | ||
} | ||
let coins = ["BTC", "BTC", "BTC"]; | ||
for coin in coins { | ||
println!("Thes best is {coin} and there is no second best"); | ||
} | ||
println!("Count is now 0 | ||
----End----"); | ||
} |