Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 228

If an expression in a return modifies an earlier result parameter, does the Go language spec guarantee the new value will be returned?

$
0
0

For example, does the Go language spec guarantee the following will print true?

https://go.dev/play/p/Rybua4uBb87

package mainimport "fmt"func main() {    fmt.Println(modify_result_parameter_after_return())}func modify_result_parameter_after_return() (b bool, _ error) {    return b, set(&b)}func set(b *bool) error {    *b = true    return nil}

Viewing all articles
Browse latest Browse all 228

Trending Articles