[Newbies] ifTrue ifFalse help

Matthias Berth matthias.berth at googlemail.com
Wed Apr 27 06:12:07 UTC 2011


try

  bool = $a

to get what you expect. A String consists of Characters (Character is
a separate class).

You could also do

  'abc' inspect

to see what's going on :)

Cheers

Matthias

On Wed, Apr 27, 2011 at 08:05, calcrisk33 <rick.m.wallace at gmail.com> wrote:
> Given:
>
> | binnum index bool|
> binnum := 'abc'.
> index := 1.
> bool:=(binnum at: index).
> (bool = 'a')
>        ifTrue: [Transcript show: 'ifTrue'; cr]
>        ifFalse: [Transcript show: 'ifFalse'; cr].
> Transcript show: bool; cr.
>
> Why does this result in:
>
> ifFalse
> a
>
> and not
>
> ifTrue
> a
>
> I've tried both = and == with no success.
>
> Any help is much appreciated!
>
> --
> View this message in context: http://forum.world.st/ifTrue-ifFalse-help-tp3477318p3477318.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>


More information about the Beginners mailing list