Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active October 14, 2025 11:31
Show Gist options
  • Save JoeGlines/cd19459a9fd0e9b623b63107d0b8067d to your computer and use it in GitHub Desktop.
Save JoeGlines/cd19459a9fd0e9b623b63107d0b8067d to your computer and use it in GitHub Desktop.
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