Skip to content

Commit

Permalink
14.7 funcao closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruteski committed Mar 27, 2024
1 parent 37a4fc7 commit 2ca8a50
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 14-funcoes_avacadas/14.7-funcao_closure/closure.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import "fmt"

func closure() func() {
texto := "Dentro da funcao closure"

funcao := func() {
fmt.Println(texto)
}

return funcao
}

func main() {
texto := "dentro da funcao main"
fmt.Println(texto)

funcaoNova := closure()
funcaoNova()
}

0 comments on commit 2ca8a50

Please sign in to comment.