Skip to content

Instantly share code, notes, and snippets.

@dereknguyen269
Created October 27, 2023 07:02
Show Gist options
  • Save dereknguyen269/db618587d5d0f1c790f78de348c40bb7 to your computer and use it in GitHub Desktop.
Save dereknguyen269/db618587d5d0f1c790f78de348c40bb7 to your computer and use it in GitHub Desktop.
Go Code Demo
package main
import "fmt"
func main() {
// Declare a variable of type int
var age int
// Get the user's age
fmt.Println("Enter your age:")
fmt.Scanf("%d", &age)
// Check if the user is over 18
if age >= 18 {
fmt.Println("You are an adult.")
} else {
fmt.Println("You are a minor.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment