Mercurial > repos > other > SevenLanguagesInSevenWeeks
diff 2-Io/day1.io @ 29:9c7af76fdbd0
Print isn't PrinLn, so add some \n characters to the output
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 06 Sep 2017 18:36:02 +0100 |
parents | 25e66d77e1fe |
children | d43f60e98f39 |
line wrap: on
line diff
--- a/2-Io/day1.io Tue Sep 05 21:00:21 2017 +0100 +++ b/2-Io/day1.io Wed Sep 06 18:36:02 2017 +0100 @@ -1,6 +1,6 @@ # Calling "functions" is sending a "message" (right) to an object (left) # ↓ object ↓ message -"Hi ho, Io" print +"Hi ho, Io\n" print # Object creation is by cloning and modifying root "Object" object # Convention appears to be that classes start with capitals @@ -11,13 +11,18 @@ # So this would fail because the slot doesn't exist - we'll repeat it at the end to stop it crashing our program too early! # Vehicle another_field = "This won't work" -# Fetching values is just calling the function (but we need an extra "print" to print to stdout) +# Fetching values is just calling the function +# (but we need to skip ahead of what's in the book and chain an extra "print" to print to stdout) Vehicle description print +"\n" print # In addition to the slot we created, there is a default slot called "type" # (and presumably some default messages, because slotNames apparently isn't a slot!) Vehicle slotNames print +"\n" print Vehicle type print +"\n" print Object type print +"\n" print Vehicle another_field = "This won't work" \ No newline at end of file