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() { | |
variableOne := 10 | |
variableTwo := 20 | |
updateData(variableOne, variableTwo) | |
fmt.Println("Value of variable one in main Function is", variableOne) | |
} |
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() { | |
getData(10, 20) | |
} | |
func getData(inputData ...int) { | |
for value, index := range inputData { | |
fmt.Printf("Value at index %d is %d \n", value, index) |
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() { | |
getData(1, 2) | |
getData(1, 2, 3) | |
} | |
func getData(inputData ...int) { | |
fmt.Println("Number of Parameter Received:", len(inputData)) |
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() { | |
fmt.Printf("Hello world, the first parameter is: %d", 42) | |
fmt.Printf("Hello world, the first parameter is: %d, second parameter is %d", 42, 32) | |
} |
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() { | |
userName, _ := getValues() | |
fmt.Println("User Name is:", userName) | |
} | |
func getValues() (string, int) { | |
return "Mayank", 34 |
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() { | |
userName, userAge := getValues() | |
fmt.Println("User Name is:", userName) | |
fmt.Println("User Age is:", userAge) | |
} |
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() { | |
userName, userAge, isDeveloper := getValues() | |
fmt.Println("User Name is:", userName) | |
fmt.Println("User Age is:", userAge) | |
fmt.Println("Is User a Developer:", isDeveloper) | |
} |
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() { | |
userName, userAge, isDeveloper := getValues() | |
fmt.Println("User Name is:", userName) | |
fmt.Println("User Age is:", userAge) | |
} | |
func getValues() (string, int) { |
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() { | |
variableOne, variableTwo := getValues() | |
fmt.Println("Value for variable one is:", variableOne) | |
fmt.Println("Value for variable two is:", variableTwo) | |
} | |
func getValues() (int, int) { |
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() func() { | |
return func() { | |
fmt.Println("Data Returned from Function") | |
} | |
}() |
NewerOlder