Modify

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#2634 closed Feature Request (Fixed)

Treat keyword Default like an unset optional parameter

Reported by: water Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Default optional parameter Cc:

Description

When keyword Default is passed to a function for an optional parameter it should be replaced by the default value for this parameter.
This would save a lot of statements in many UDFs to set the value of a parameter to the default value as defined in the Func statement for optional parameters.

Example: The MsgBox should always display 1 for P1 even when passed as keyword Default.

_Test()
_Test(Default)
Func _Test($P1 = 1, $P2 = 2)
	MsgBox(0, "Parameters", "P1: " & $P1 & @CRLF & "P2: " & $P2)
EndFunc

Has been discussed here: http://www.autoitscript.com/forum/topic/139892-enhance-autoit-udfs/page-5#entry995563

Attachments (0)

Change History (3)

comment:1 by mLipok, 11 years ago

is it completed now ?

_Test()
_Test(Default)
Func _Test($P1 = 1, $P2 = 2)
	MsgBox(0, "Parameters", "P1: " & $P1 & @CRLF & VarGetType($P1) &@CRLF & "P2: " & $P2)
EndFunc

comment:2 by J-Paul Mesnage, 11 years ago

Resolution: Fixed
Status: newclosed

I agree, I can't remember when ...

comment:3 by mLipok, 11 years ago

Please consider if this change do not need some more description in HelpFile

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.