June 2017
Beginner
1091 pages
22h 9m
English
Flow control is referred as the ability to decide which portion of code or how many times you execute some code on a condition. In Go, it is implemented using familiar imperative clauses like if, else, switch and for. The syntax is easy to grasp. Let´s review major flow control statements in Go.
Go language, like most programming languages, has if…else conditional statement for flow control. The Syntax is similar to other languages but you don't need to encapsulate the condition between parenthesis:
ten := 10
if ten == 20 {
println("This shouldn't be printed as 10 isn't equal to 20")
} else {
println("Ten is not equals to 20");
}
The else...if condition works in a similar fashion, you don't need parentheses either ...
Read now
Unlock full access