0

I want to print "Best Country" based on numbers in swift

for example : - if i enter " 1 " it will print "Best". if i enter " 2 " it will print " Country ". For 1 and 2 it will print " Best Country ".

how to manually enter numbers in swift ?

Gereon
  • 17,258
  • 4
  • 42
  • 73
Ios developer
  • 95
  • 1
  • 8
  • Welcome to Stack Overflow! You seem to be asking for someone to write some code for you. Stack Overflow is a question and answer site, not a code-writing service. Please see here https://stackoverflow.com/help/how-to-ask to learn how to write effective questions. – Dharmesh Kheni Dec 07 '18 at 06:35
  • No i am not asking any one to write code . i want any one to help me how to enter number manually like "c" language without textfield – Ios developer Dec 07 '18 at 06:45
  • Yes i am writting it in swift playground. but how to do it ? – Ios developer Dec 07 '18 at 06:53
  • You can't read keyboard input from within a playground. Create a command line tool and use `readLine()` – Gereon Dec 07 '18 at 07:06

1 Answers1

1

As per the OP it seems a project with console input/output is desired. To input values from console. You need to create a console based project with swift selected as Language.

Xcode -> New -> Project...
then select appropriate option as in screenshot below : enter image description here

Press Next and then fill in the required details (project Name etc...)

Rizwan
  • 3,324
  • 3
  • 17
  • 38