GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing gobyexample.com — Go by Example: 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 +.

    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)
}
$ go run values.go
golang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

Next example: Variables.

by Mark McGranaghan and Eli Bendersky | source | license

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.