Last active
October 14, 2025 11:31
-
-
Save JoeGlines/cd19459a9fd0e9b623b63107d0b8067d to your computer and use it in GitHub Desktop.
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() { | |
| // Explicit typing | |
| var userName string = "Bob" | |
| var userAge int = 25 | |
| // Type inference with := | |
| score := 100 // int | |
| isActive := true // bool | |
| price := 29.99 // float64 | |
| // Go will yell at you if types don't match | |
| // score = "high" // ERROR! Can't assign string to int | |
| fmt.Printf("%s is %d years old\n", userName, userAge) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment