Created
December 30, 2020 05:16
-
-
Save ridhoperdana/178e3c547924e09852e319ed0399e150 to your computer and use it in GitHub Desktop.
example of multiple task inside 1 function
This file contains hidden or 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 addEngineerAndPrintNames(currentEngineer []string, newEngineer string) (updatedEngineers []string) { | |
updatedEngineers = append(currentEngineer, newEngineer) | |
for index, engineer := range updatedEngineers { | |
fmt.Printf("Some string at index %v with value %v", index, engineer) | |
} | |
return updatedEngineers | |
} | |
func main() { | |
engineers := []string{"John", "Doe", "Budi"} | |
engineers = addEngineerAndPrintNames(engineers, "Agus") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment