explain tricky err switch
This commit is contained in:
parent
342ffb491d
commit
3b081dae26
@ -31,9 +31,9 @@ func main() {
|
|||||||
for {
|
for {
|
||||||
switch line, err := rdr.ReadString('\n'); err {
|
switch line, err := rdr.ReadString('\n'); err {
|
||||||
|
|
||||||
// If the read succeeded, write out out the
|
// If the read succeeded (the read `err` is nil),
|
||||||
// uppercased line. Check for an error on the
|
// write out out the uppercased line. Check for an
|
||||||
// write as we do on the read.
|
// error on this write as we do on the read.
|
||||||
case nil:
|
case nil:
|
||||||
ucl := strings.ToUpper(line)
|
ucl := strings.ToUpper(line)
|
||||||
if _, err = out.WriteString(ucl); err != nil {
|
if _, err = out.WriteString(ucl); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user