Please bear with me folks, remember there are no stupid questions. I'm an absolute beginner (did a fair amount of Pascal years ago).
I'm getting a surplus line feed which shouldn't be there.
var plustax:Double = 0
/ Variable plustax declared here, not inside the function as the book has it. Bugger! */
func printTaxed (pretax:Double) {
plustax = pretax * 1.2
print(plustax)
}
printTaxed(pretax:100)
printTaxed(pretax:25.78)
printTaxed(pretax:105.789)
Gives this output -
120.0
30.936
126.9468
Fine so far.
But this
func printTaxed2 (pretax:Double, taxrate:Double) {
plustax = pretax * taxrate
print(plustax)
}
print(printTaxed2(pretax:150, taxrate: 4/3)) //surplus brackets ‘()’ on next line?
print(printTaxed2(pretax:150, taxrate: 1.3333))
Gives me this -
200.0
()
199.995
()
Whence the linefeed plus () ?