Modify

Opened 11 years ago

Closed 9 years ago

Last modified 9 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 Changed 9 years ago by mLipok

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 Changed 9 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from new to closed

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

comment:3 Changed 9 years ago by mLipok

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

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.