Created
October 27, 2023 07:02
-
-
Save dereknguyen269/db618587d5d0f1c790f78de348c40bb7 to your computer and use it in GitHub Desktop.
Go Code Demo
This file contains hidden or 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" | |
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