You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
463 B
Go
23 lines
463 B
Go
5 years ago
|
// Go has various value types including strings,
|
||
|
// integers, floats, booleans, etc. Here are a few
|
||
|
// basic examples.
|
||
|
|
||
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main() {
|
||
|
|
||
|
// Strings, which can be added together with `+`.
|
||
|
fmt.Println("go" + "lang")
|
||
|
|
||
|
// Integers and floats.
|
||
|
fmt.Println("1+1 =", 1+1)
|
||
|
fmt.Println("7.0/3.0 =", 7.0/3.0)
|
||
|
|
||
|
// Booleans, with boolean operators as you'd expect.
|
||
|
fmt.Println(true && false)
|
||
|
fmt.Println(true || false)
|
||
|
fmt.Println(!true)
|
||
|
}
|