changeset 31:2bbabcbc4802

Swap to println after finding out about it in the next section
author IBBoard <dev@ibboard.co.uk>
date Wed, 06 Sep 2017 18:48:15 +0100
parents d43f60e98f39
children 4d3769ac447c
files 2-Io/day1.io
diffstat 1 files changed, 13 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/2-Io/day1.io	Wed Sep 06 18:42:44 2017 +0100
+++ b/2-Io/day1.io	Wed Sep 06 18:48:15 2017 +0100
@@ -1,6 +1,6 @@
 # Calling "functions" is sending a "message" (right) to an object (left)
 # ↓ object  ↓ message
-"Hi ho, Io\n" print
+"Hi ho, Io" println
 
 # Object creation is by cloning and modifying root "Object" object
 # Convention appears to be that classes start with capitals
@@ -13,49 +13,37 @@
 
 # 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
+Vehicle description println
 
 # 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 slotNames println
+Vehicle type println
+Object type println
 
 # Now we start making a Ferrari as a type of car
 Car := Vehicle clone
 # Car only directly has one slot
 # (Q: How do we find out inhereted slots?)
-Car slotNames print
-"\n" print
-Car type print
-"\n" print
+Car slotNames println
+Car type println
 # But because of prototype cloning, the description remains the same
-Car description print
-"\n" print
+Car description println
 
 # Now we make a specifc car
 ferrari := Car clone
 # But this hasn't gained any slots because it is lower-case
-ferrari slotNames print
-"\n" print
+ferrari slotNames println
 # It does still have a type, though
-ferrari type print
-"\n" print
+ferrari type println
 
 # Types don't mean anything specific - they're just a handy convention
 # Variables are case sensitive, so we can make an entire type of Ferraris
 Ferrari := Car clone
-Ferrari type print
-"\n" print
-Ferrari slotNames print
-"\n" print
+Ferrari type println
+Ferrari slotNames println
 # And the lower-case version is unaffected
-ferrari slotNames print
-"\n" print
+ferrari slotNames println