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

Fall2002 Midterm Review: Reading Code

On Transcript:

The do block executes 4 times, once for each element in the array

I believe 'hello' is printed an infinate number of times, because test is assigned the value true from the expression "(i<10)" evalutates to true. If test was assigned " [ (i<10) ] ", then 'hello' would be printed 9 times.

Trayton Otto

For the first part of this question, it prints 'abcdefghi,jkl' on my transcript and the do: loop gets executed 5 times. It seems to run once for the comma.

For the second part, wouldn't there be a MessageNotUnderstood error? Since test is assigned as a Boolean object and Boolean's don't understand whileTrue?

The block executes a total of three times. The comma turns the two elements in the collection into one.

What type of objects do understand whileTrue? Booleans do understand while true, so it would just run infinite number of times.

Link to this Page