Why my code is not working? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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") } } }

11th May 2021, 4:08 PM
Ishika Kansal
12 Antworten
+ 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
11th May 2021, 4:11 PM
Atul [Inactive]
+ 1
Because you have used the curly bracket of for loop twice
11th May 2021, 4:11 PM
Atul [Inactive]
+ 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
11th May 2021, 5:05 PM
Atul [Inactive]
+ 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
11th May 2021, 5:29 PM
Atul [Inactive]
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?
11th May 2021, 5:03 PM
Ishika Kansal
0
It's not working
11th May 2021, 5:18 PM
Ishika Kansal
0
Ishika Kansal Which one??
11th May 2021, 5:19 PM
Atul [Inactive]
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
11th May 2021, 5:20 PM
Ishika Kansal
0
Ok
11th May 2021, 6:00 PM
Ishika Kansal
0
Thanks ☺️
11th May 2021, 6:00 PM
Ishika Kansal
0
How to solve test case 2
11th May 2021, 6:03 PM
Ishika Kansal
- 1
Kha se ho aap
13th May 2021, 5:30 AM
Aashish Kumar
Aashish Kumar - avatar