Return a tuple:
func getTime() -> (Int, Int, Int) {
...
return ( hour, minute, second)
}
Then it’s invoked as:
let (hour, minute, second) = getTime()
or:
let time = getTime()
println("hour: \(time.0)")
More Related Contents:
- How could I create a function with a completion handler in Swift?
- Static vs class functions/variables in Swift classes?
- What are the differences between functions and methods in Swift?
- Static function variables in Swift
- Table name as a PostgreSQL function parameter
- How can I return two values from a function in Python?
- What is the difference between PHP echo and PHP return in plain English?
- How to use a return statement in a for loop?
- What is the difference between a “function” and a “procedure”?
- How can I use `return` to get back multiple values from a for loop? Can I put them in a list?
- Is there a way to use two ‘…’ statements in a function in R?
- Swift optional escaping closure parameter
- How to alias a function name in Fortran
- Parenthesis Powershell functions
- How to profile methods in Scala?
- How to deal with name/value pairs of function arguments in MATLAB
- Exporting a function in shell
- D3 Key Function
- VB.NET Function Return
- Override a function that is imported in a namespace
- Is it better to return `undefined` or `null` from a javascript function? [closed]
- Accessing returned values from a function, by another function
- How do I get the return value when using Python exec on the code object of a function?
- Scala Functional Literals with Implicits
- Does dart support operator overloading
- Eta-expansion between methods and functions with overloaded methods in Scala
- How to evaluate functions in GDB?
- Matlab ode45. How to change a parameter inside it while calling it?
- How do you strip the unit from any number in SASS?
- In R, what exactly is the problem with having variables with the same name as base R functions?