Golang - Recycled Variables

Reused Variables in Golang In general it’s a bad idea to reuse/recycle variables (see: Software Design/Don’t reuse a variable). It makes code less readable, debugging more difficult, and can lead to bad designs. The following sections will highlight some issues with reused/recycled variables in Go. range range is a Go built-in keyword provided to iterate over arrays and slices. The syntax is shorter than C-style for loops ForStmt = “for” [ Condition | ForClause | RangeClause ] Block ....

2021-06-11 1325 words 7 min