Advertisement
Guest User

Go lang by mendax v2.0

a guest
Jan 6th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.44 KB | None | 0 0
  1. package main
  2. import (
  3.         "fmt"
  4. )
  5. //This is what I was talking about
  6. //The string after hello() declares what type to return, weird that it is suffixed not prefixed
  7. func hello() string {
  8.   //We can either say what the type of the variable is
  9.   var hw_i string
  10.   hw_i = "Hello "
  11.   //Or we can let Go decide by using ':='
  12.   hw_f := "World"
  13.   retval := hw_i + hw_f
  14.   return retval
  15. }
  16. func main() {
  17.   pr_val := hello()
  18.   fmt.Println(pr_val)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement