Optional Parameters
How should optional parameters be handled? Note: All examples allow the second parameter to be optional.
26 members have voted
-
1. How should optional parameters be handled? Note: All examples allow the second parameter to be optional.
-
func test($var1, optional $var2) - var2 is equal to @null (new macro)4
-
func test($var1, $var2 = "") - var2 is already set to something, if nothing else was specified22
-
func test(["value 1", "value 2"]) - UDF would see it as one single parameter and split it. Will not be possible until array declaration syntax is done ([URL=http://www.autoitscript.com/forum/index.php?showtopic=5730]Check here for a discussion[/URL])0
-
opt("ExpandVarStrings", 1) $s = Chr(22) func test("value 1$s$value 2") - stretching a little on this one, but can be done now with the unstable0
-
-
Recently Browsing 0 members
- No registered users viewing this page.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now