Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Forked from jacaetevha/gist:3795784
Created June 5, 2013 21:22
Show Gist options
  • Save rwaldron/5717428 to your computer and use it in GitHub Desktop.
Save rwaldron/5717428 to your computer and use it in GitHub Desktop.
exampleWithNumber: x
"A method that illustrates every part of Smalltalk method syntax
except primitives. It has unary, binary, and keyword messages,
declares arguments and temporaries, accesses a global variable
(but not and instance variable), uses literals (array, character,
symbol, string, integer, float), uses the pseudo variables
true false, nil, self, and super, and has sequence, assignment,
return and cascade. It has both zero argument and one argument blocks."
|y|
true & false not & (nil isNil) ifFalse: [self halt].
y := self size + super size.
#($a #a "a" 1 1.0)
do: [:each | Transcript show: (each class name);
show: ' '].
^ x < y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment