Excellent new 'Declare' command

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Excellent new 'Declare' command

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Franco.

Well we don't need a 2 pass compiler anymore for more flexibility while coding.
The new 'Declare' command does it all!

Excellent work Fred

While there is no example file and no documentation/explanation for it, here is an example how to use it.
Remember: if you 'Declare' a Procedure you must have the same amount of parameters later used!

Have fun!

Code: Select all

;Declare example
;This is neat!

;now the user can declare a procedure with:
Declare MyProcedure(Message.s)

;and then call the procedure
MyProcedure("My Message")

;and place the actual procedure anywhere
;but the 'Declare' and actual 'Procedure'
;must have the same parameters

;actual procedure
Procedure MyProcedure(Message.s)
  MessageRequester("Declare a Procedure", Message)
EndProcedure
Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
Well we don't need a 2 pass compiler anymore for more flexibility while coding.
The new 'Declare' command does it all!
Hooray!! That's exactly what I was looking for, either that or a procedure stack and in fact, having a DECLARE statement makes the compiler keep a procedure stack for out of order calling. No more worries about which of the gazillion routines I have to put where!! Party time :)

Fangles
Post Reply