Created
April 3, 2022 09:05
-
-
Save KateLin-BASIC/21cab5e677909312ff742731694956df to your computer and use it in GitHub Desktop.
For & Foreach in Pharo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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