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

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
arg_declaration:
IDENTIFIER type
{ printf("\033[1;35mARG: %s\n\033[0m", $1); }
identifiers_list type
{ printf("\033[1;35mARG DECLARATIONS:\n\033[0m"); }
;
arg_list:

View File

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