Make parameter of Hour(), Second() etc. optional

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Make parameter of Hour(), Second() etc. optional

Post by c4s »

This is a really small request, similar as making the start position parameter at FindString() optional...

I'd like the parameters of Second(), Minute(), Hour(), Day() etc. to be optional. By default the functions would simply return the current date. Example:

Code: Select all

Debug Year(Date())  ; Returns 2011

Debug Year()  ; Would also return 2011 and is a little easier to read
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
infratec
Always Here
Always Here
Posts: 7586
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Make parameter of Hour(), Second() etc. optional

Post by infratec »

Hi c4s,

if it is only for 'readability', why not use an includefile with some Macros inside.
For example

Code: Select all

Macro CurrentYear()
  Year(Date())
EndMacro

Debug CurrentYear()
So you can build a file with many Macros inside.
If they are not used, they don't disturb your normal program.

Bernd

P.S.: Maybe we should start an includefile with helpfull Macros of all users.
Post Reply