Skip to content

Instantly share code, notes, and snippets.

@KateLin-BASIC
Created April 3, 2022 09:05
Show Gist options
  • Save KateLin-BASIC/21cab5e677909312ff742731694956df to your computer and use it in GitHub Desktop.
Save KateLin-BASIC/21cab5e677909312ff742731694956df to your computer and use it in GitHub Desktop.
For & Foreach in Pharo
| array |
"For (With variable)"
1 to: 10 do: [ :i | Transcript show: i; cr ].
"For (Without variable)"
10 timesRepeat: [ Transcript show: 'Iterating...'; cr ].
"Foreach"
array := #(Bill Zoey Louis Francis).
array do: [ :each | Transcript show: each; cr ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment