Skip to content

Instantly share code, notes, and snippets.

@anettodev
Created April 8, 2019 01:51
Show Gist options
  • Save anettodev/7bf04d0aa2e49e75ab2cb6fe98e62fa1 to your computer and use it in GitHub Desktop.
Save anettodev/7bf04d0aa2e49e75ab2cb6fe98e62fa1 to your computer and use it in GitHub Desktop.
// Sum 2 Numeric elements
func sum<T: Numeric>(x: T, y: T) -> T {
return x + y
}
sum(3, 4.5) // result 7.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment