-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditions.go
41 lines (34 loc) · 890 Bytes
/
conditions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"log"
)
func main() {
var myVar int
var myVar2 string
fmt.Println("Type any number ?")
_, _ = fmt.Scan(&myVar)
fmt.Println("Type any animal name ?")
_, _ = fmt.Scan(&myVar2)
if myVar < 100 && myVar2 == "cat" {
log.Println("Variable is less than 100 and other variable is equal to cat")
} else if myVar > 100 && myVar2 == "cat" {
log.Println("yes variable is greater than 100 and other variable is equal to cat")
} else {
log.Println("I don't know what to do anything")
}
switch myVar {
case 100:
log.Println("Variable is equal to 100")
case 200:
log.Println("Variable is equal to 200")
case 300:
log.Println("Variable is equal to 300")
case 400:
log.Println("Variable is equal to 400")
case 500:
log.Println("Variable is equal to 500")
default:
log.Println("Variable must be bigger than 500 or less than 100")
}
}