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

Username:   Password: 
 RegisterRegister   
 Array of proc help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shamikh




PostPosted: Mon Jun 02, 2008 5:05 pm   Post subject: Array of proc help

I need to create an array of procs.

var lol : array 0..5 of proc
lol(1):= ole

put lol(1)




procedure ole
put "ole"
end ole


but it wont work. it says 1 needs to be an identifier any help?
Sponsor
Sponsor
Sponsor
sponsor
richcash




PostPosted: Mon Jun 02, 2008 5:14 pm   Post subject: RE:Array of proc help

You have to declare the procedure before you assign it to your array.
Shamikh




PostPosted: Mon Jun 02, 2008 5:16 pm   Post subject: RE:Array of proc help

How do i do that?
richcash




PostPosted: Mon Jun 02, 2008 5:23 pm   Post subject: Re: Array of proc help

By putting your procedure before the line(s) where you initialize your array. (You can declare the body of your procedure later if you use the forward and body keywords.) For example :
Turing:
var lol : array 0 .. 5 of proc p
procedure ole
    put "ole"
end ole
lol (1) := ole


And upon further inspection of your code :
You need to put an identifier for your array of procedures as I did above.
Turing:
var lol : array 0 .. 5 of proc p


And also you can't put a procedure. You call a procedure. If you want a subprogram that returns a result you have to use a function.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: