Discussion:
Interesting challenge problem
(too old to reply)
johannes falcone
2015-01-07 07:06:16 UTC
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number

post your squeak of pharo solution!
s***@metanews.biz
2015-01-14 03:47:48 UTC
Interesting.

(1 to: 100) do: [ :num | |res| res := ''. ((0 to: 100 by: 3) includes: num) ifTrue: [ res := 'foo' ]. ((0 to: 100 by: 5) includes: num) ifTrue: [ res := res, 'bar' ]. (res size = 0 ) ifTrue: [ Transcript show: num asString;cr ] ifFalse: [ Transcript show: res; cr ] ].
Post by johannes falcone
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number
post your squeak of pharo solution!
c***@gmail.com
2015-01-29 20:24:27 UTC
[true] whileTrue: [ Transcript show: 'Johannes Falcone == Gavino == Sad instance of class #Troll';cr;'Do not feeed';cr;cr].
Post by johannes falcone
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number
post your squeak of pharo solution!
scott lewis
2015-01-30 04:24:41 UTC
Two questions:

1. What do you actually mean by this?

2. Why == instead of = ?
Post by c***@gmail.com
[true] whileTrue: [ Transcript show: 'Johannes Falcone == Gavino == Sad instance of class #Troll';cr;'Do not feeed';cr;cr].
Post by johannes falcone
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number
post your squeak of pharo solution!
johannes falcone
2015-02-01 15:11:44 UTC
Post by c***@gmail.com
[true] whileTrue: [ Transcript show: 'Johannes Falcone == Gavino == Sad instance of class #Troll';cr;'Do not feeed';cr;cr].
Post by johannes falcone
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number
post your squeak of pharo solution!
don't be mean
nicolas cellier aka nice
2015-02-13 23:09:41 UTC
Post by johannes falcone
Post by c***@gmail.com
[true] whileTrue: [ Transcript show: 'Johannes Falcone == Gavino == Sad instance of class #Troll';cr;'Do not feeed';cr;cr].
Post by johannes falcone
count from 1 to 100
if number is divisible by 3 print foo
if by 5 print bar
if by 3 and 5 print foobar
if none of above print the number
post your squeak of pharo solution!
don't be mean
I suggest you try http://codegolf.stackexchange.com/questions/88/obfuscated-fizzbuzz-golf/10561#10561
It's fizzbuzz rather than foobar, but should be easy to adapt ;)