Adding a newline to an Array

Torsten.Bergmann at phaidros.com Torsten.Bergmann at phaidros.com
Mon Nov 17 10:15:44 UTC 2003


Look at instance creation methods of Collection (Array
is a subclass). You will notice #with:with:with:
so you just write:

Array 
  with: $a 
  with: $b 
  with: Character lf 

This is good for your example with an array of 3 elements.
Otherwise use #new: and #at:put: messages as Stephane suggested.

Bye
Torsten


-----Original Message-----
From: Danie Roux
To: The general-purpose Squeak developers list
Sent: 16.11.03 18:14
Subject: Adding a newline to an Array

Hi,

Bit green to Smalltalk and having trouble with putting a newline
character in an array:

#($a $b $c) "would give me an array with the three characters a, b and c
in it."

lf := Character lf. " Would give me the lf character "

Now how do I put lf in an array?

#($a $b #lf) " Doesn't seem to work?" 

-- 
Danie Roux *shuffle* Adore Unix





More information about the Squeak-dev mailing list