Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Create a Throwing Function Swift

// create throwing function using throws keyword
func division(numerator: Int, denominator: Int) throws {

// throw error if divide by 0
  if denominator == 0 {
    throw DivisionError.dividedByZero
  }
  ...     
}
 
PREVIOUS NEXT
Tagged: #Create #Throwing #Function #Swift
ADD COMMENT
Topic
Name
2+9 =