Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift Closure That Returns Value

// closure definition
var findSquare = { (num: Int) -> (Int) in
  var square = num * num
  return square
}

// closure call
var result = findSquare(3)

print("Square:",result)
 
PREVIOUS NEXT
Tagged: #Swift #Closure #That #Returns #Value
ADD COMMENT
Topic
Name
4+3 =