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

Username:   Password: 
 RegisterRegister   
 need if section help for ISP
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
person




PostPosted: Tue Jan 11, 2005 7:32 pm   Post subject: need if section help for ISP

How do i get the code to stop by not using "quit" or "Window.Close" when (something) happens? Thanks for reading!

if (something) then
(do not continue to the rest of the code)
end if
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Jan 11, 2005 8:21 pm   Post subject: (No subject)

If that if statement is inside a loop, you could use exit to quit the loop. Mind you, anything after that would still be executed. To get around that, you could use a flag (boolean) variable like this:
code:

var flag := false
loop
if condition = true then
  flag := true
end if
exit when flag
end loop
if flag = false then
loop
%more stuff
end loop
end if


Another thing you could do is:
code:

if condition = true then
  loop
  end loop
end if

And you can stall your program forever. Yay. I don't really know why you wouldn't want to use quit or Window.Close, however. Thinking
Tony




PostPosted: Tue Jan 11, 2005 9:54 pm   Post subject: (No subject)

I think the easiest (and what makes most sence) is to just have the function return a value. It doesn't have to mean anything, I used to use return 0; as breaks in code Laughing

anyways, turing is backwards, you have to use result instead.
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: