0
Why my code is not working?
package main import "fmt" func main() { for i:=0; i<5; i++ { { if i == 1 { fmt.Println ("One") } else if i == 2 { fmt.Println ("Two") } else if i == 3 { fmt.Println("Three") } } }
12 ответов
+ 1
package main
import "fmt"
func main() {
for i:=0; i<5; i++ {
{
if i == 1 {
fmt.Println ("One")
} else if i == 2 {
fmt.Println ("Two")
} else if i == 3 {
fmt.Println("Three")
}
}
}}
//Add one more curly bracket in last
+ 1
Because you have used the curly bracket of for loop twice
+ 1
package main
import "fmt"
func main () {
for i:=0; i<5; i++ {
if i == 1 {
fmt.Println("One")
} else if i == 2 {
fmt.Println("Two")
} else if i == 3 {
fmt.Println("Three")
}
}
}
//This should be the correct code
+ 1
package main
import "fmt"
func main () {
for i:=0; i<5; i++ {
if i==1 {
fmt.Println("One")
} else if i==2 {
fmt.Println("Two")
} else if i==3 {
fmt.Println("Three")
}
}}
//Println statement is wrong
0
package main
import "fmt"
func main () {
for i:=0; i<5; i++ {
{
if i == 1 {
fmt.Println("One")
} else if i == 2 {
fmt.Println("Two")
} else if i == 3 {
fmt.Println("Three")
}
}
}
}
Why my code is not working?
0
It's not working
0
Ishika Kansal Which one??
0
package main
import "fmt"
func main () {
for i:=0; i<5; i++ {
if i==1 {
fmt.println("One")
} else if i==2 {
fmt.println("Two")
} else if i==3 {
fmt.println("Three")
}
}
}
This one
0
Ok
0
Thanks ☺️
0
How to solve test case 2
- 1
Kha se ho aap