Can ReadLine() be used in if statements.

I want the user to input their ethnicity and then from what they enter it prints the out their home country. Any way how I can do this I tried using an if statement but no luck.

5/3/2019 7:28:17 AM

Zach Prozach

2 Answers

New Answer


Can you show us the code sample. Than we can help you with it.


let ethnicity = readLine() if ethnicity == "African" { print("Africa") } if ethnicity == "Chinese" { print("china") }