We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06eba1c commit 2f23bacCopy full SHA for 2f23bac
05_loops/loops.go
@@ -0,0 +1,47 @@
1
+// for looping only "FOR"
2
+package main
3
+import "fmt"
4
+
5
+func main(){
6
+ //WHILE LOOP FASHION - FOR
7
+ i := 1
8
+ for i<=3 {
9
+ fmt.Println(i)
10
+ i=i+1
11
12
+ }
13
14
+ //INFINITE LOOP
15
+ /*
16
+ for {
17
+ println ("1")
18
19
+ */
20
21
+ //FOR LOOP
22
23
+ for i:=0;i<3;i++{
24
25
26
27
+ //CONTINUE - AND - BREAK is also used
28
29
+ //break - stops the loop
30
31
32
33
34
+ //continue- current iterations stops
35
+ if i=2{
36
+ continue //--- 2 will never come
37
38
39
40
41
+ //RANGE-want to do some thing for some times
42
+ for i:= range 3 {
43
44
+ } //OUTPUT - 1,2
45
46
47
+}
0 commit comments