golang_condition-only_for

Golang condition-only for Statement

Golang condition-only for - Golang Condition-Only for Statement

The Condition-Only for Statement

Go allows you to leave off both the initialization and the increment in a for statement. That leaves a for statement that functions like the while statement found in C, Java, JavaScript, Python, Ruby, and many other languages. It looks like Example 4-9.

Example 4-9. A condition-only for statement

i := 1 for i < 100 { fmt.Println(i) i = i * 2 }

golang_condition-only_for.txt · Last modified: 2025/02/01 06:54 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki