Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift Multiple Return Values

func compute(number: Int) -> (Int, Int, Int) {

  var square = number * number

  var cube = square * number
  
  return (number, square, cube)
}

var result = compute(number: 5)

print("Number:", result.0)
print("Square:", result.1)
print("Cube:", result.2)
Source by www.simpleswiftguide.com #
 
PREVIOUS NEXT
Tagged: #Swift #Multiple #Return #Values
ADD COMMENT
Topic
Name
4+3 =