Question about empty return

package main

func main() {
var example=10
if example==10{
return
}
}

Can you get information about empty return in function , in loop, in condition? Thank you

I do not understand your question. What kind of information do you want to pull from the empty return?

There is no value returned, so you don’t get any information beyond “the function has finished”.

So when I specify naked “return” I don’t get any value but I obtain finish of function?

The answer to many of your questions is in The Go Programming Language Specification.

For the return statement: Return statements.

For example, in part,

A “return” statement in a function F terminates the execution of F , and optionally provides one or more result values.

In a function without a result type, a “return” statement must not specify any result values.

Whenever a return statement is executed, naked or otherwiae, the function always terminates.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.