Counter class. Select its renderOn: method.
- before the message pattern. This marks the current method as an instance method. Class methods have a + (Objective-C developers will recognize this convention).
counter instance variable has a @ prefix. This one’s taken from Ruby.
@counter into a separate method. Replace @counter := @counter + 1 with self increment and hit Save.
increment method:
- increment @counter := @counter + 1.Until you add the final period (which is required), there will be a PARSE ERROR message below the code pane. Once you’ve got it right, hit Save.
increment should appear in the list of methods on the left.
@counter + 10, etc.
renderOn: method. The Methods menu shows all of the selectors that are sent by this method. Let’s choose onClick:.
onClick:. This is equivalent to an implementors browser for that selector.
onClick:, which is the JQuery class. Click on JQuery in the class column to see the complete JQuery protocol.
onClick: search. The ← and → buttons work like in a web browser.
JQuery and onClick: that are just above the code pane. Clicking on onClick: will change the search to #onClick:, which is equivalent to a senders browser. You can see that it’s mostly sent from within the Browser class which implements Cæsar.
Counter to the search field so that it reads #onClick: Counter. This filters the methods to only be those within the Counter class (in this case, just renderOn:).