Skip to content

Instantly share code, notes, and snippets.

View Agilulfe's full-sized avatar

Guillaume Jacobs Agilulfe

View GitHub Profile
@Agilulfe
Agilulfe / main.go
Created January 1, 2021 18:47
Switch statement
package main
import "fmt"
func main() {
var preference string
fmt.Scanln(&preference)
switch preference {
case "meat":
fmt.Println("You will receive a menu for the meat")
@Agilulfe
Agilulfe / main.go
Created September 9, 2020 15:31
Variables tutorial
package main
import "fmt"
var y = "Hello, Scope!"
func main() {
var x string
x = "Hello, World!"
fmt.Println(x)
@Agilulfe
Agilulfe / main.go
Created September 9, 2020 14:35
Go scope with an error
package main
import "fmt"
func main() {
x := "Hello, Scope!"
fmt.Println(x)
testScope()
}
@Agilulfe
Agilulfe / main.go
Last active September 9, 2020 14:27
Go scope with a global variable
package main
import "fmt"
var x = "Hello, Scope!"
func main() {
fmt.Println(x)
testScope()
}
@Agilulfe
Agilulfe / main.go
Last active August 21, 2020 13:44
Basic types in go
package main
import (
"fmt"
"reflect"
)
func main() {
fmt.Println(1.51-1.50 == 0.01)
fmt.Println(1 + 1)
@Agilulfe
Agilulfe / main.go
Created August 21, 2020 13:36
TypeOf with Go
package main
import (
"fmt"
"reflect"
)
func main() {
fmt.Println(reflect.TypeOf(5))
fmt.Println(reflect.TypeOf(5.0))
@Agilulfe
Agilulfe / main.go
Last active August 21, 2020 13:39
Floating-points in Go
package main
import (
"fmt"
)
func main() {
fmt.Println(1.51-1.50 == 0.01)
}
@Agilulfe
Agilulfe / main.go
Last active August 18, 2020 14:55
Hello World in Go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}