Video:

If/Else Statements in Go

May 7, 2021

Course Instructor: Elliot Forbes

Hey Gophers! My name is Elliot and I'm the creator of TutorialEdge and I've been working with Go systems for roughly 5 years now. Feel free to reach out to me on twitter - @Elliot_F

Code

package main

func main() {
	println("If Statements in Go")
	var customerHeight int = 140
	customerAge := 18

	if customerHeight >= 150 || customerAge >= 18 {
		println("can access ride")
	} else if customerHeight >= 120 {
		println("customer can access children's rides")
	} else {
		println("customer is too small")
	}
}

Output

$ go run main.go
If Statements in Go
can access ride