Friday, 21 August 2015

Basic Go: If statement

The if statement looks as it does in C or Java, except that the ( ) are gone and the{ } are required.


Like for, the if statement can start with a short statement to execute before the condition.
Variables declared by the statement are only in scope until the end of the if.
(Try using v in the last return statement.)


If and else

Variables declared inside an if short statement are also available inside any of theelse blocks.



Do comment, if it worked/Not worked for you.

No comments:

Post a Comment