0% found this document useful (0 votes)
32 views1 page

Go by Example: Understanding Values

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views1 page

Go by Example: Understanding Values

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like