Solve the assessment in Pharo Smalltalk and please loop the whole code in two ways whileTrue: and do loops.
Here is what I tried but it gives me a wrong answer.
| x y z count elem sum |
x := #(84 45 54).
sum := 0.
z := 1.
y := x size.
elem := x at: z.
[z < y] whileTrue: [ elem even ifTrue: [sum := sum + elem.]. z := z + 1.].
Transcript clear.
Transcript show: sum.