Old newIncrement

Report a typo

Below you will see an anonymous function assigned to the increment variable. However, there is a shadowed variable within the anonymous function declaration — find the shadowed variable and fix it so it doesn't shadow the variable from the outer scope anymore.

Sample Input 1:

2

Sample Output 1:

5
Write a program in Go
package main

import "fmt"

func main() {
var number int
fmt.Scan(&number)

// Find the shadowed variable within the anonymous function below and fix it:
increment := func() {
number := number * 2 // nolint: gocritic
number++
}

increment()
fmt.Println(number)
}
___

Create a free account to access the full topic