Computer Science Canada

Restart the program?

Author:  w00tw00t [ Tue Sep 28, 2004 9:18 am ]
Post subject:  Restart the program?

Hey im making a program right now that puts stuff in arrays and out to a file and other junk like that. I was wondering what the code would be to start the program over again without having to exit and go back into it? Thanks.

Author:  apomb [ Tue Sep 28, 2004 9:55 am ]
Post subject: 

put the whole thing into a loop and when the program comes to the end

code:

var  yn : string 
loop
   %your program here
   would you like to restart? (y/n)
   get yn
   exit when yn = "n"
end loop

Author:  w00tw00t [ Tue Sep 28, 2004 10:41 am ]
Post subject: 

thanks man, dont know why i didnt think of it X| lol i guess i was just hoping there was a command for it.

Author:  Paul [ Tue Sep 28, 2004 2:28 pm ]
Post subject: 

Well you could have procedures and then clear the variables when the program is done, then call the procedure again, if you're only starting it over once, if you want to do it multiple times, you still need a loop.

Author:  Flea [ Fri Oct 08, 2004 8:51 pm ]
Post subject: 

if youre only repeating the program once, you could use a for loop.

for i : 1 .. 2
(program here)
end for


: