Let's take a look once again at the newIncrement() function from theory:
func newIncrement() func() int {
var number int
return func() int {
number += 1
return number
}
}
And create a new function! But you need to make two upgrades:
- the
newIncrement()function should take as an argument thestartvalue of a number; - the
newIncrement()function should increment thenumbervariable by the value ofinc.
Your program will take as input two numbers: a start value and an inc value. Finally, you need to print the result of increment.