-
-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathIfElse.go
More file actions
36 lines (31 loc) · 534 Bytes
/
IfElse.go
File metadata and controls
36 lines (31 loc) · 534 Bytes
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
package main
import (
"fmt"
)
func main() {
// If Statement
x := true
if x {
fmt.Println("True")
}
// If-Else Statement
y := 100
if y > 80 {
fmt.Println("Greater than 80")
} else {
fmt.Println("Lesser than 80")
}
// If-Elseif Statement
grade := 5
if grade == 1 {
fmt.Println("You have an A")
} else if grade > 1 && grade < 5 {
fmt.Println("You have no A but you are positiv")
} else {
fmt.Println("Your grade is negativ")
}
// If statement initialization
if a := 10; a == 10 {
fmt.Println(a)
}
}