mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00:00
Updated closure
Corrected closure example that referenced assigning x to e^10, which does not happen in this iteration. Set x to a value large enough to make the comments hold true.
This commit is contained in:
parent
4e118150a2
commit
427f87c655
@ -221,7 +221,8 @@ func learnFlowControl() {
|
||||
xBig := func() bool {
|
||||
return x > 10000 // References x declared above switch statement.
|
||||
}
|
||||
fmt.Println("xBig:", xBig()) // true (we last assigned e^10 to x).
|
||||
x = 99999
|
||||
fmt.Println("xBig:", xBig()) // true
|
||||
x = 1.3e3 // This makes x == 1300
|
||||
fmt.Println("xBig:", xBig()) // false now.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user