This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
returnedData := func() string { | |
return "This is Sample String Return Value" | |
}() | |
fmt.Println("Value Returned from Anonymous Function: %s", returnedData) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
func(inputData string) { | |
fmt.Println(inputData) | |
}("This is String Data") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
functionVariable := func() { | |
fmt.Println("Anonymous Function Executed") | |
} | |
functionVariable() | |
functionVariable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
func() { | |
fmt.Println("Anonymous Function Executed") | |
}() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func executeCode() { | |
fmt.Println("Defered Function call is Executed") | |
} | |
func main() { | |
username := "Mayank gupta" | |
defer executeCode() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nupResources.go | |
package main | |
import ( | |
"io" | |
"log" | |
"os" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"log" | |
"os" | |
) | |
func main() { | |
if err := write("readme.txt", "This is a readme file"); err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func updateData(currentScope string) { | |
fmt.Println(currentScope) | |
} | |
func updateDataOther(currentScope string) { | |
fmt.Println(currentScope) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func updateData(currentScope string) { | |
fmt.Println("UserName value is ", currentScope) | |
} | |
func main() { | |
defer updateData("Defered Function Called") | |
currentScope := "Main Function" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func updateData(userName string) { | |
userName = "Mayank Gupta" | |
fmt.Println("Updated values is ", userName) | |
} | |
func main() { | |
userName := "TechnoFunnel" |