❮ Basics
❯
- Println
- :=
Hello Foo - 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 `Println function inserts a space between the values it prints. For better control about this you can use Printf.
examples/hello-foo/hello_foo.go
package main import ( "fmt" ) func main() { name := "Foo" fmt.Println("Hello", name) }
Hello Foo