Hacker News new | past | comments | ask | show | jobs | submit login

I like the style, brevity, and practicality of the book (at least the first few chapters; haven't read it all yet). Good stuff and good luck with it.

I did find the first few examples with the REPL to be a bit confusing. Were you using a function before it was defined?




Thanks :) The REPL example with the error has a deliberate typo (int instead of Int) to show how multi-line editing works in the REPL - is that the part you're asking about?


I was referring to this:

$ swift Welcome to Swift! Type :help for assistance. 1> 3.14 * 2.5 * 2.5 $R0: Double = 19.625 2> println("The area of the circle is \($R0)") The area of the circle is 19.625 3> 4> $R0 * 2 $R1: Double = 39.25 5> println("And double that is \($R1)") And double that is 39.25 6>

What's Double? Trying to follow this (which didn't make sense to me because I didn't know the history stuff was there) simply caused error messages.


Isn't Double just a bigger floating point number?


Right. A double has twice the precision of a float (hence the name). It's also the default floating point data type in Swift.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: