Question: Write this code in Swift language in xcode. NO Java or C++ code. Just swift file Write a program that reads in a string and

Write this code in Swift language in xcode. NO Java or C++ code. Just swift fileĀ 


Write a program that reads in a string and passes to a function named parse(digit:) that takes a string with one character as a parameter. The function should return -1 if the input is not a digit character and the digit otherwise. Use Switch statement instead of for-in loop parse(digit: "1") // 1 parse(digit: "3") // 3 parse(digit: "a") // -1

Step by Step Solution

3.43 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question is complete Here is the Swift code that you aske... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!