Question: Using Swift, Write a program that reads in a string and passes to a function named parse(digit:) that takes a string with one character as
Using Swift, Write a program that reads in a string and passes to 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. You must use a switch statement 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
