Похожие чаты

What does exactly swich case do in GO ? are

thye just check for the value of the variable and then do something base on the result ? so what the problem is with my code ?

1 ответов

10 просмотров

Not only in go, switch case in every language is meant to check the equality of a variable with a value, not to check whether a value meets some condition or not. Say if you want to see variable animal is dog or cat or any other, using if else ladder you'll be using so many == checks. Instead you can use switch there

Похожие вопросы

Обсуждают сегодня

Карта сайта