46 if firstSeen >= 0 {
47 secondSeen = i
48 break
49 } else { 50 firstSeen = i
51 }
52 }
220 if math.IsNaN(v) {
221 rv = math.NaN()
222 break
223 } else {224 total++
225 rv *= v
226 }
To ensure as little nesting as possible (to improve code readability), the
else
blocks that can be eliminated should be removed. For example, if the if
block contains a return
statement, the else
block can be omitted entirely.
for {
if ok := f(); ok {
a := 1
continue
} else {
return "it's NOT okay!"
}
}
for {
if ok := f(); ok {
a := 1
continue
}
return "it's NOT okay!"
}