Last active
August 21, 2020 13:44
-
-
Save Agilulfe/cfe81a5695c06e8bd767958d3c11022a to your computer and use it in GitHub Desktop.
Basic types in go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
fmt.Println(1.51-1.50 == 0.01) | |
fmt.Println(1 + 1) | |
fmt.Println(1 - 1) | |
fmt.Println(2 * 2) | |
fmt.Println(2 / 2) | |
fmt.Println(3 % 2) | |
fmt.Println(len("")) | |
fmt.Println(len(" ")) | |
fmt.Println(len("Go is an amazing language")) | |
fmt.Println("Learning Go is a good investment"[1]) | |
fmt.Println("Hello, " + "World!") | |
fmt.Println(true && true) | |
fmt.Println(true && false) | |
fmt.Println(false && false) | |
fmt.Println(true || true) | |
fmt.Println(true || false) | |
fmt.Println(false || false) | |
fmt.Println(!true) | |
fmt.Println(!false) | |
fmt.Println(reflect.TypeOf(5)) | |
fmt.Println(reflect.TypeOf(5.0)) | |
fmt.Println(reflect.TypeOf(5 + 5.0)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment