Go by Example: Values [Link]
com/values
Go by Example: Values
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 +. [Link]("go" + "lang")
Integers and floats. [Link]("1+1 =", 1+1)
[Link]("7.0/3.0 =", 7.0/3.0)
Booleans, with boolean operators as you’d expect. [Link](true && false)
[Link](true || false)
[Link](!true)
}
$ go run [Link]
golang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false
Next example: Variables.
by Mark McGranaghan and Eli Bendersky | source | license
1 of 1 11/26/24, 23:21