446 out.WriteString(line[:x])
447 out.WriteRune(newLine)
448 break
449 } else {450 // Write everything as is.
451 out.WriteString(lines[i])
452 }
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!"
}