[Newbies] Re: Unknown error
Ben Coman
btc at openInWorld.com
Fri Jun 6 18:09:37 UTC 2014
ParadoxMachine wrote:
> That worked, thanks.
>
> By the way, how do I put strings (or a string and a number) together? The
> way I did it requires me to write more than a single "Transcript show:"
> line.
>
> -ParadoxMachine
>
Two alternatives...
* Transcript crShow: 1 asString, String tab, 2 asString.
* Transcript crShow: 1 ; tab ; show: 2.
As well, you may find the links useful...
http://wiki.squeak.org/squeak/5699
http://www.eli.sdsu.edu/courses/spring01/cs635/readingSmalltalk.pdf
btw, just some general feedback on your code. Since b is set to 1 before
the loop and at the end of the loop, it is equivalent to just do that at
the start of the loop instead (unless you are relying on b=1 after the
loop. And here is an alternative...
0 to: 9 do: [ :a |
b := 1.
a timesRepeat: [b := b*2].
Transcript show: '2^a = '.
Transcript show: b ;cr.
].
cheers, Ben
More information about the Beginners
mailing list