[Pharo-project] Complete an Array

Luc Fabresse luc.fabresse at gmail.com
Sat Oct 23 09:02:48 EDT 2010


Hi Simon,

 If I understand well, you should use a dot to separate the two expressions
in the block.

|test isFact|

test := Array new:5.
isFact := False.
test doWithIndex:[ :each :i | ((each isNil) & (isFact = False))
    ifTrue:[
         test at:i put:'plain'.
         isFact := True
        ]
    ].


#Luc


2010/10/23 Simon De Baets <debaetssimon at gmail.com>

> Hello,
>
> I use Pharo 1.1 .  I want to add a new element in an array that have a part
> of nil element. I want to add this new element on the first nil case. I
> produce this code
>
> |test isFact|
>
> test := Array new:5.
> isFact := False.
> test doWithIndex:[ :each :i | ((each isNil) & (isFact = False))
>     ifTrue:[
>          test at:i put:'plain'; isFact := True
>         ]
>     ].
> test.
>
> But it doesn't function because they are two instruction in the ifTrue
> bolck. So my question is : "How can i put two instructions in an ifTrue
> block?"
>
> Thanks,
>
> --
> Simon De Baets,
> Etudiant en MA1 informatique à l'ULB
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20101023/8b1c1c05/attachment-0001.html>


More information about the Pharo-dev mailing list