rstacruz / cheatsheets

Cheatsheets for web development - devhints.io
https://devhints.io
13.85k stars 3.59k forks source link

Replace "for" loop with "while" loop in [file name] #2158

Open navjot369 opened 4 months ago

navjot369 commented 4 months ago

Description

In the file "go.md", there is "for" wirtten that should be a "while" loop instead.

Current code

n := 0
x := 42
for n != x {
  n := guess()
}

Proposed change

Replace "for" with a "while" keyword.

matheushb commented 3 months ago

In golang, the while loop uses the "for" keyword