publish values
This commit is contained in:
parent
c151aa3601
commit
cdc3184c30
@ -1,5 +1,5 @@
|
|||||||
Hello World
|
Hello World
|
||||||
# Values
|
Values
|
||||||
# Variables
|
# Variables
|
||||||
# Short Declarations
|
# Short Declarations
|
||||||
# Constants
|
# Constants
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
// Go has various value types, including strings,
|
// Go has various value types including strings,
|
||||||
// different types of numbers, booleans, etc.
|
// integers, floats, booleans, etc. Here are a few
|
||||||
|
// basic examples.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// Here are some strings, which can be added together.
|
// Strings, which can be added together with `+`.
|
||||||
fmt.Println("Hello world")
|
fmt.Println("Hello " + "world")
|
||||||
fmt.Println("Hello " + "other")
|
|
||||||
|
|
||||||
// Some examples of integers and floats.
|
// Integers and floats.
|
||||||
fmt.Println("1+1 =", 1+1)
|
fmt.Println("1+1 =", 1+1)
|
||||||
fmt.Println("7.0/3.0 =", 7.0/3.0)
|
fmt.Println("7.0/3.0 =", 7.0/3.0)
|
||||||
|
|
||||||
// And booleans, which work as you'd expect.
|
// Booleans, with boolean operators as you'd expect.
|
||||||
fmt.Println(true && false)
|
fmt.Println(true && false)
|
||||||
fmt.Println(true || false)
|
fmt.Println(true || false)
|
||||||
fmt.Println(!true)
|
fmt.Println(!true)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
$ go run values.go
|
$ go run values.go
|
||||||
Hello world
|
Hello world
|
||||||
Hello other
|
|
||||||
1+1 = 2
|
1+1 = 2
|
||||||
7.0/3.0 = 2.3333333333333335
|
7.0/3.0 = 2.3333333333333335
|
||||||
false
|
false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user