-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.go
59 lines (50 loc) · 850 Bytes
/
loop.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
)
func main() {
fmt.Print("Enter your age: ")
var age int
fmt.Scanf("%d", &age)
//if boolean_expression {
//logic or statement here
//}
if age < 3 {
fmt.Println("infant")
}else if 5>2 && 5<13 {
fmt.Println("children")
}else if age>12 && age <= 19{
fmt.Println("teen age")
}else{
fmt.Println("adult")
}
//fixed value
/*
switch age {
case 2:
fmt.Println("infant")
case 3,4,5,6,7,8,9,10,11,12:
fmt.Println("children")
default:
fmt.Println("adult")
}
*/
//fmt.Println(age)
//for loop
/* for i:1; i<9; i++ {
fmt.Println(i)
}
*/
//array string literals
/*
students := []string{"Al","Mamun","Khan"}
for i, std := range students {
fmt.Println(i, std)
}
*/
i:=0
for i<10 {
fmt.Println(i,"Hello")
i++
}
}