Basically when you pass a value into a function that takes a float, if the type hasn't been explicitly resolved, it will coerce it into a float (if it can, it wouldnt do it on a string).
So when you say "why can you pass integers", well you're not really. It's just 2 is being turned into a float.
Glad it's helpful!
I hope this will help: play.golang.org/p/gTXh3vhOj-z
Basically when you pass a value into a function that takes a float, if the type hasn't been explicitly resolved, it will coerce it into a float (if it can, it wouldnt do it on a string).
So when you say "why can you pass integers", well you're not really. It's just 2 is being turned into a float.
Does that make sense?
Thanks Chris. Yes that makes sense.