Squeak programming question

Patrick Logan patrickl at gemstone.com
Mon Mar 22 20:48:00 UTC 1999


> I pretty much subscribe to the solutions proffered so far (returning
> an array and using a block).  However I offer the following for your
> entertainment (fasten seat belts)...

Given a method like:

twoValues
	^ {1. 2}

then the following code fragment

	{a. b} := self twoValues.

will result in a=1, b=2.

In fact you can even do

	{a. b} := {b. a}

to exchange two values without a third temporary variable.

	- Dan





More information about the Squeak-dev mailing list