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

master2
serr 2025-05-18 19:35:54 +03:00
parent 519717e3eb
commit b243bdafad
3 changed files with 26 additions and 1 deletions

View File

@ -106,6 +106,10 @@ math_expr_or_literals_list:
math_expr_or_literals_list_or_empty:
| math_expr_or_literals_list
types_list:
| type
| types_list COMMA type
//
// condition
@ -342,7 +346,9 @@ arg_list:
;
return_type:
| type { }
| type
| LPAREN types_list RPAREN { }
| LPAREN arg_list RPAREN { }
;
func_declaration:

View File

@ -2,6 +2,10 @@ package main
import "fmt"
func add(x, y int) (z, f, u int, a string) {
z = x + y
return
}
func main() {
a := 1e6
fmt.Println(a)

View File

@ -2,6 +2,21 @@ package main;
import "fmt";
func A(x, y int) {
}
func B(x, y int) () {
}
func C(x, y int) int {
}
func D(x, y int) (int, string) {
}
func E(x, y int) (z, f, u int, a string) {
}
// анонимные функции
func anon_func(a,b,c,d string, a int) {
// Присваиваем анонимную функцию переменной