result := String new.
1 to: 10 do: [:n | result := result, n printString, ’ ’].
Everything in smalltalk is an object and the objects interact through messages.
I couldn't understand how the above code is understanding the message to:do:
How is it able to iterate the block from 1 to 10? How does it know it has to repeat the block that many number of times?
Can someone explain what happens under the hood?