Hello Foo - Println
- Println
- :=
In go you can use the :=
operator to declare a variable and assign a value to it at the same time. Then you can use that variable in a Println
.
As you might notice, (I did not when I first tried this), the ``Printlnfunction inserts a space between the values it prints. For better control about this you can use
Printf`.
package main
import (
"fmt"
)
func main() {
name := "Foo"
fmt.Println("Hello", name)
}
Hello Foo