File tree 2 files changed +56
-0
lines changed
2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ let condition = false ;
3
+
4
+ let number = if condition { 5 } else { 4 } ;
5
+
6
+ if number % 4 == 0 {
7
+ println ! ( "number is divisible by 4" ) ;
8
+ } else if number % 3 == 0 {
9
+ println ! ( "number is divisible by 3" ) ;
10
+ } else if number % 2 == 0 {
11
+ println ! ( "number is divisible by 2" ) ;
12
+ } else {
13
+ println ! ( "number is not divisible by 4, 3 or 2" ) ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ println ! ( "----Start----" ) ;
3
+ let mut counter = 0 ;
4
+ let result = loop {
5
+ counter += 1 ;
6
+ println ! ( "counter is {counter}" ) ;
7
+ if counter == 10 {
8
+ break counter * 2 ;
9
+ }
10
+ } ;
11
+ println ! ( "The result is {result}" ) ;
12
+
13
+ let mut count = 0 ;
14
+ ' counting_up: loop {
15
+ println ! ( "Count: {count}" ) ;
16
+ let mut remaining = 10 ;
17
+
18
+ loop {
19
+ println ! ( "Remaining: {remaining}" ) ;
20
+ if remaining == 9 {
21
+ break ;
22
+ }
23
+ if count == 2 {
24
+ break ' counting_up;
25
+ }
26
+ remaining -= 1 ;
27
+ }
28
+ count += 1 ;
29
+ }
30
+
31
+ while count != 0 {
32
+ println ! ( "Not zero yet" ) ;
33
+ count -= 1 ;
34
+ }
35
+ let coins = [ "BTC" , "BTC" , "BTC" ] ;
36
+ for coin in coins {
37
+ println ! ( "Thes best is {coin} and there is no second best" ) ;
38
+ }
39
+ println ! ( "Count is now 0
40
+ ----End----" ) ;
41
+ }
You can’t perform that action at this time.
0 commit comments