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

Username:   Password: 
 RegisterRegister   
 Quck Question for procedures!!! sould take just a sec
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
thainfamous




PostPosted: Tue Nov 30, 2004 10:26 am   Post subject: Quck Question for procedures!!! sould take just a sec

When you make a procedure, how do you make an if statement checking if the procedure has been processed.

Example: there is a procedure that makes someone move and you want to check if that procedure has been executed. If it has been processed, then do something, otherwise do not
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Tue Nov 30, 2004 12:09 pm   Post subject: (No subject)

I'm not sure what you're trying to do. Why not just do this at the end of the procedure?
cool dude




PostPosted: Tue Nov 30, 2004 1:14 pm   Post subject: (No subject)

i'm not sure wat u want but by my understanding u just want to see if the procedure works. all u have to do is call the procedure right after u made it.
Delos




PostPosted: Tue Nov 30, 2004 2:57 pm   Post subject: (No subject)

code:

var run : array 1..3 of boolean
for i : 1..3
    run(i) := false
end for

procedure firstToRun
    put "I'm first!"
    run(1) := true
end firstToRun

% other procs...

firstToRun
secondToRun
% Note!  No 'thirdToRun' is called.

if run(1) then
put "Yes, the first has run."
else
put "Nope, one has not run"
end if

%...etc etc.


BTW, I typed this directly into the reply box, so there may be syntax errors etc...you get the point of it though.
wtd




PostPosted: Tue Nov 30, 2004 3:13 pm   Post subject: (No subject)

Well, since it's a procedure, I assume it's changing something. So just check to see if that thing it's changing has... changed.

Of course, the real question is why you question whether or not it's running.

Post the code!
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  [ 5 Posts ]
Jump to:   


Style:  
Search: