Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Exit When
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
WesWes




PostPosted: Sun Dec 15, 2002 6:34 pm   Post subject: Exit When

Hey,

I was wondering if someone can give me an example of an exit out of a loop...

I really need it...just like the other people on this message board.

So far, this is what I have:

%Calculation Screen
procedure calc
for c : 7 .. 10
locate (10, 25)
color (c)
put "Calculting"
delay (500)
end for
end calc

%-------Calculation Screen
loop
calc
exit when calc = 4
end loop

But the "calc = 4" part doesn't work.

All suggestions would be greatly appreciated. Thanks for your time.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Dec 15, 2002 6:37 pm   Post subject: (No subject)

thats because calc is a procedure, not a function so it doesn't return a value so it doesn't equal to anything.

so you can ether change your procedure to a function or compare some other variable for exit statment
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
WesWes




PostPosted: Sun Dec 15, 2002 6:56 pm   Post subject: (No subject)

Thanks, dude.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: