[Newbies] \n equivalent?
Michael van der Gulik
mikevdg at gmail.com
Thu Jul 30 23:56:23 UTC 2009
On Fri, Jul 31, 2009 at 8:48 AM, Paul DeBruicker <pdebruic at gmail.com> wrote:
> Hi -
>
> What Character or String is equal to \n in C or Python? Thanks
>
I remember wondering about this when I was first learning Smalltalk too.
You do stuff like:
s := WriteStream on: (String new: 100).
s nextPutAll: 'Hello World'. "Write a string"
s nextPut: $!. "Write a single character"
s cr. "Write a newline character"
It's a bit wordy, but I think streams deserve a lot more credit than
programmers give them.
If you're doing String concatenation:
myString := 'Hello, World!', String cr.
Alternatively, this is also valid code:
myString := 'This
is
a
multi-line
String!
'.
Gulik.
--
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20090731/386735d4/attachment.htm
More information about the Beginners
mailing list