--- Begin Message ---Op 30-4-2020 om 10:31 schreef Ben Coman:collection := '8569 2478 0383 3437'.(collection reverse selectWithIndex: [:item :index | (index % 2 == 0) ifTrue: [item *2]] ) inspectI see a error and the non-even numbers are nill now. but after some figgeling this seems to work : collection := '8569247803833437'asArray.checkNumber := (collection reverse withIndexCollect: [:item :index | (index % 2 == 0) ifTrue: [item asInteger *2] ifFalse: [item asInteger]] ) sum inspect^ checkNumber isDivisibleBy: 10
--- End Message ---
- [Pharo-users] mentor question 4 Roelof Wobben via Pharo-users
- Re: [Pharo-users] mentor question 4 Ben Coman
- Re: [Pharo-users] mentor question 4 Roelof Wobben via Pharo-users
- Re: [Pharo-users] mentor questi... Ben Coman
- Re: [Pharo-users] mentor qu... Roelof Wobben via Pharo-users
- Re: [Pharo-users] mentor question 4 Stéphane Ducasse
- Re: [Pharo-users] mentor question 4 Pablo Navarro
- Re: [Pharo-users] mentor questi... Richard O'Keefe
- Re: [Pharo-users] mentor qu... Pablo Navarro
- Re: [Pharo-users] mentor question 4 Roelof Wobben via Pharo-users
- Re: [Pharo-users] mentor question 4 Roelof Wobben via Pharo-users
- Re: [Pharo-users] mentor question 4 Richard O'Keefe
- Re: [Pharo-users] mentor question 4 Roelof Wobben via Pharo-users