Skip to main content


Showing posts from August, 2018

Control Statements in Golang

The beauty of every programming language is defined by the flow of the program i.e by the Control Statements!. Yes, Control statements defines the flow of the program through the blocks of  statements defined. Go language provides control statements as like other languages but with different usage possibilities.

Types Of Control Statements There are three types of control statements available with Golang: Conditional, Unconditional and Loop.
Conditional Statements Conditional statements are statements which would execute the branch of statements conditionally. They are if, if-else , else-if and switch.
If statementif control statement controls the execution of the branch of statements based on the condition given. The syntax is,
if conditions { // statements to be executed } Let's look at the below example
if age == 5 { fmt.Println("Come back when you turn 6 to join 1st standard!") } In Golang, we can have initialization statement right before the conditional …