Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- //This is what I was talking about
- //The string after hello() declares what type to return, weird that it is suffixed not prefixed
- func hello() string {
- //We can either say what the type of the variable is
- var hw_i string
- hw_i = "Hello "
- //Or we can let Go decide by using ':='
- hw_f := "World"
- retval := hw_i + hw_f
- return retval
- }
- func main() {
- pr_val := hello()
- fmt.Println(pr_val)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement