Basics types in Go

strings, integers, floats, booleans etc

Add operation on strings concatenate, multiplication on strings multiplicate howarrow-up-right

Mathematical operations on int and float produce equivalent output with upcast (increasing in the degree of type)

and / or / not on boolean returns boolean

Values

package main

import (
	"fmt"
)


func main() {
	fmt.Println("hello world")
	// strings
	fmt.Println("hello" + "world")
	// int
	fmt.Printf("the int sum is %d", 1 + 2) //formatted string
	// float
	fmt.Println(1.2 + 23)
	// boolean
	fmt.Println(true && false)
	
}

Variables

Constants

Last updated