Skip to content

Commit d759e85

Browse files
committed
Ders18
1 parent 4f4b150 commit d759e85

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

18_conditional_statements/main.go

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
7+
// if <boolean expression> { code } x%2 == 0 (false)
8+
9+
/* x := 27
10+
11+
if false {
12+
fmt.Println(x, "tek sayıdır")
13+
} */
14+
15+
/* if !true {
16+
fmt.Println("Mesaj Gosterilecek")
17+
} */
18+
19+
/* if 5 > 3 {
20+
fmt.Println("Mesaj Gosterilecek mi?")
21+
} */
22+
23+
/* x := 4
24+
25+
if x%2 == 0 {
26+
fmt.Println(x, "çift sayıdır")
27+
} else {
28+
fmt.Println(x, "tek sayıdır")
29+
} */
30+
31+
// if <boolean expression> { code } else { code }
32+
33+
/* if false {
34+
fmt.Println("Mesaj Gosterilecek")
35+
} */
36+
37+
x := -5
38+
39+
if x < 0 {
40+
fmt.Println(x, "negatif sayıdır")
41+
} else if x%2 == 0 {
42+
fmt.Println(x, "çift sayıdır")
43+
} else {
44+
fmt.Println(x, "tek sayıdır")
45+
}
46+
47+
// if <boolean expression> { code } else if <boolean expression> else { code }
48+
}

0 commit comments

Comments
 (0)