добавил возможность определять несколько параметров одного типа при определении функции

master2
serr 2025-05-18 19:26:54 +03:00
parent f7eea4af7a
commit 519717e3eb
2 changed files with 6 additions and 6 deletions

View File

@ -332,8 +332,8 @@ func_call:
any_identifier LPAREN math_expr_or_literals_list_or_empty RPAREN any_identifier LPAREN math_expr_or_literals_list_or_empty RPAREN
arg_declaration: arg_declaration:
IDENTIFIER type identifiers_list type
{ printf("\033[1;35mARG: %s\n\033[0m", $1); } { printf("\033[1;35mARG DECLARATIONS:\n\033[0m"); }
; ;
arg_list: arg_list:

View File

@ -3,13 +3,13 @@ package main;
import "fmt"; import "fmt";
// анонимные функции // анонимные функции
func anon_func() { func anon_func(a,b,c,d string, a int) {
// Присваиваем анонимную функцию переменной // Присваиваем анонимную функцию переменной
square := func(x int) int { square := func(x, y int) int {
return x * x; return x * y;
}; };
fmt.Println(square(5)); // Выведет: 25 fmt.Println(square(5, 5)); // Выведет: 25
} }
// замыкания // замыкания