[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Default arguments



PureBytes Links

Trading Reference Links

Hello,

A note about default arguments.

Default argument - in a function definition, an argument with an assigned value that specifies the value an argument should assume
if none is supplied in the function call.
For example:

WriteVal( array, format = 1.2 )

format is default argument. It means that if you do NOT supply it then value 1.2 will be used.

But... if you SUPPLY it do NOT use ' format = 1.0 ' (assignment), just pass the value, nothing more.

So don't write

WriteVal( array, format = 1.0 ); // WRONG

instead write:

WriteVal( array, 1.0 ); // OK


(Note: it does not hurt if you write it with assignment, but it is completely unnecessary and only
makes code longer and less readable)

Best regards,
Tomasz Janeczko
amibroker.com


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/Tq9otC/XP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/