Question: Using Swift, Write a function named parse(digit:) that takes a string with one character as parameter. The function should return -1 if the input is
Using Swift, Write a function named parse(digit:) that takes a string with one character as parameter. The function should return -1 if the input is not a digit character and the digit otherwise.
parse(digit: "1") // 1 parse(digit: "3") // 3 parse(digit: "a") // -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
