| --- | |
| title: OutOfScopeResult | |
| layout: article | |
| --- | |
| <!-- Copyright 2023 The Go Authors. All rights reserved. | |
| Use of this source code is governed by a BSD-style | |
| license that can be found in the LICENSE file. --> | |
| <!-- Code generated by generrordocs.go; DO NOT EDIT. --> | |
| ``` | |
| OutOfScopeResult occurs when the name of a value implicitly returned by | |
| an empty return statement is shadowed in a nested scope. | |
| Example: | |
| func factor(n int) (i int) { | |
| for i := 2; i {{raw "<"}} n; i++ { | |
| if n%i == 0 { | |
| return | |
| } | |
| } | |
| return 0 | |
| } | |
| ``` | |