(Go Lang) Values (GBEN)

Go by Example: Values

Example

  • Numeric and logical operations seem to work as you would expect.
  • The , format for joining values is nice.

// 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)
golang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

Attribution

Leave a Reply

Your email address will not be published. Required fields are marked *