initpy / go-book

A book for learning the Go Programming Language
http://go-book.appspot.com/
115 stars 30 forks source link

f instead of loater #60

Open legobit opened 8 years ago

legobit commented 8 years ago

On the functions page things are declared as floater and then the code try to access it as the variable f. Guess someone did some really sloppy variablename changes


import "math"

//return A+B and A*B in a single shot func MySqrt(floater float64) (squareroot float64, ok bool){ if floater > 0 { squareroot, ok = math.Sqrt(f), true } return squareroot, ok

}

import "math"

//return A+B and A*B in a single shot func MySqrt(floater float64) (squareroot float64, ok bool) { if floater > 0 { squareroot, ok = math.Sqrt(f), true } return // Omitting the output named variables, but keeping the "return".

}