Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Цитата Паразит:
Ну так вот, что бы вы посоветовали? »
Почитать документацию:
Цитата:
Optional parameters are defined by assigning a default value to them. The value may be a global variable, macro or literal value. Optional parameters always appear last in the function definition. All parameters added after the first optional parameter must also be optional. Inside the function, the number of parameters given when the function was called can be retrieved with the @NumParams macro (see example 2).
Цитата Паразит:
Какую можно сделать хитрость? »
Код: Выделить весь код
Sample("a", "b")
Sample("a", "b", "c")
Sample("a", "b", "c", "d")

Exit(0)

Func Sample($Arg1, $Arg2, $Arg3 = "", $Arg4 = "")
	Local $i

	ConsoleWrite("Total parameters: " & @NumParams & @CRLF)

	For $i = 1 To @NumParams
		ConsoleWrite(@TAB & "Parameter #" & $i & ": " & Eval("Arg" & $i) & @CRLF)
	Next

	ConsoleWrite(@CRLF)
EndFunc
Цитата:
Код: Выделить весь код
Total parameters: 2
	Parameter #1: a
	Parameter #2: b

Total parameters: 3
	Parameter #1: a
	Parameter #2: b
	Parameter #3: c

Total parameters: 4
	Parameter #1: a
	Parameter #2: b
	Parameter #3: c
	Parameter #4: d
Это сообщение посчитали полезным следующие участники:

Отправлено: 10:03, 13-02-2017 | #2