So I guess that floor > 0 is your condition, right? In Smalltalk, the idea is that you evaluate the condition and ask the result of it (usually true or false) to do something.
Right so far? That would mean the receiver of your wanted message is either the result of the evaluation or or a Block which will be evaluated in a construct like ifTrue: or something like whileTrue: HTH Joachim > Am 09.11.2018 um 08:24 schrieb Roelof Wobben <[email protected]>: > > Hello, > > I try to solve a adventofcode challenge where I must find out when santa is > first at the basement. the floor is there -1. > So I thought I use a while loop like this : > > santaFloorOnBasement > "calculates which step take Santa to the basement" > | index| > index := 1. > ??? when: (floor >=0 ) do: > [ floor := (input at: index = '(' ) > ifTrue: [ floor + 1 ] > ifFalse: [ floor - 1 ]. > index := index + 1 ]. > > but I cannot find out what must be instead of the ?? > > index is the index of the string which has to start with a 1. > floor and input are both instance variables. floor contains the current > floor and input the input of the challenge. > > Can someone help me figure this out so the next time I can do this on my own. > > Roelof > > >
