Conditional structures: Difference between revisions

m (Added Kabap)
Line 2,062:
</lang>
If allows a statement to be included ahead of the condition. This is commonly a short variable declaration, as in,
<lang go>if x := fetchSomething(); if x > 0 {
DoPos(x)
} else {
Line 2,068:
}</lang>
In this case the scope of x is limited to if statement.
 
===Switch===
Simple usage is,
Anonymous user