Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created January 9, 2022 20:58
Show Gist options
  • Save percybolmer/4b4ce72c48eb2a2ba0f705812c1aa7f9 to your computer and use it in GitHub Desktop.
Save percybolmer/4b4ce72c48eb2a2ba0f705812c1aa7f9 to your computer and use it in GitHub Desktop.
func main(){
var a int = 20
var b int = 10
result := Subtract(a, b)
var c float32 = 20.5
var d float32 = 10.3
result2 := Subtract[float32](c, d)
result3 := Subtract(c, d)
fmt.Println("Result: ", result)
fmt.Println("Result2: ", result2)
fmt.Println("Result3: ", result3)
// Create a generic Results type, and set the instantitation to int
var resultStorage Results[int]
resultStorage = append(resultStorage, result)
fmt.Println("ResultStorage: ", resultStorage)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment