I tried the project module say the number which part is wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I tried the project module say the number which part is wrong?

package main import "fmt" func main() { //your code goes here x := 1 if x == 1 { fmt.Println("One") } else if x == 2 { fmt.Println("Two") } else { fmt.Println("Three") } }

17th May 2021, 1:03 AM
Mokh. Aria Wirakusumah
Mokh. Aria Wirakusumah - avatar
2 Answers
+ 1
Just loop over the switch 3 times
17th May 2021, 4:39 AM
Atul [Inactive]
0
Your code will print "one", because x=1, and your not taking inputs. if/else statements are fine. But I suggest to use switch.
18th May 2021, 5:18 AM
Vishwajeet V Durgekar
Vishwajeet V Durgekar - avatar