For Loop

A for statement where:

  • there are no break statements referring to the statement
  • loop condition is missing
  • there is the continue
  • statement
  • A break statement terminates the execution of the innermost for, switch or select statement within it < /li>

A for statement with a range clause iterates through all entries of an array, slice, string, or map, or values ​​received in a channel.

For each entry, it assigns iteration values ​​to the corresponding iteration variables, if present, and then executes the block.


for indication, value := range meuArray {...}
                        
for.go