package
0.0.0-20240712133535-75229b5999a3
Overview
For
- normal
for <init>; <condition>; <post> {
- while
for <condition> {
- forever
for {
- can control execution using
break
& continue
if
- with statements
if <statement>; <condition> {
var
s declared within statement are available only within if / else if / else
block
- no break
- statements are optional
- top-down execution - where execution stops after a case succeeds
- normal
switch <value> { case <match>
- takes statement
switch <statement>; <value> { case <match>
- conditional
switch { case <bool-statement>:
for
along with range
- range returns
index
& element
for index, element := range "abc" {
for <index>, <value> := range <var> {
- For maps:
for <key>, <value> := range <map-type> {