View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Fall2004 Midterm Review: Reading Code

1. 'abcdefghijkl' appears on the Transcript. The Transcript show only executes once since it is not a part of the do: loop. -Jason Sirichoke
2. The do: loop gets executed 4 times, once for each element in anArray. -Jason Sirichoke
3. Edit: it prints an infinite loop of hellos -Jason Sirichoke

and 3 could be corrected to print hello 10 times (pretty clearly the desired result) as follows:
| i test |
i := 1.
test := [i < 10].
test whileTrue: [Transcript show: 'hello'.
	i := i + 1.].
Though this is all late in coming, Patrick Jarrett concurs with all of Jason's answers.

Actually it would print hello 9 times (i goes from [1,9]) - Eric Withrow
yes, thanks -ellie

Link to this Page