Re: [go-nuts] write func with optional bool return value

2021-08-27 Thread Vasiliy Tolstov
Ok, thank you for the clarification пт, 27 авг. 2021 г. в 18:18, Axel Wagner : > > No, it is not possible. The *only* functions that can return either one or > two returns are builtins. > That's because the number of returns is part of the type of a function, so it > is constant for every

Re: [go-nuts] write func with optional bool return value

2021-08-27 Thread 'Axel Wagner' via golang-nuts
No, it is not possible. The *only* functions that can return either one or two returns are builtins. That's because the number of returns is part of the type of a function, so it is constant for every function. Builtin "functions", OTOH, are not really functions, in terms of the language. They are

Re: [go-nuts] write func with optional bool return value

2021-08-27 Thread Vasiliy Tolstov
I know, so my question is - does it possible to write such functions like builtin? For example I can create func via reflect пт, 27 авг. 2021 г. в 18:03, Levieux Michel : > > Hi, > > Optional returns and parameters don't exist in go, what you are referring to > is built-in behavior specific

Re: [go-nuts] write func with optional bool return value

2021-08-27 Thread Levieux Michel
Hi, Optional returns and parameters don't exist in go, what you are referring to is built-in behavior specific to some features. A good way to approach what you want is by assigning it to the anonymous '_' var when you don't want the returned bool. Hope this helps Le ven. 27 août 2021 à 16:58,

[go-nuts] write func with optional bool return value

2021-08-27 Thread Vasiliy Tolstov
Does it possible to have own func that have string, bool return value, but bool value optional? Like receiving from channel or get element from map, or like when casting to some type interface? -- Vasiliy Tolstov, e-mail: v.tols...@selfip.ru -- You received this message because you are