1. Go - Basics
https://gobyexample.com // has a lot of tutorials
Statements are single line instructions. Expressions are like "2+2".
Statement example: fmt.Println(2+2)
- Whole line is a statement, 2+2 is the expression.
Can declare multiple statements on a single line by separating them with a semi-colon.
fmt.Println("TOOD") ; fmt.Println("DAD")
Example Code:
package main
import "fmt"
func functionB(a int) int{
temp := a * 5
return temp
}
func functionA() {
fmt.Println("world")
}
func deferredfunction() {
}
func main() {
defer deferredfunction()
var test string
test = "hello"
fmt.Println(test)
functionA()
test2 := functionB(5)
fmt.Println(test2)
banana := 50.50
fmt.Println(banana)
}
Comments
Post a Comment