Swift Program To Read A String From The User

Swift Program To Read A String From The User

Swift Program To Read A String From The User

// Swift program to read a string 
// from the user

import Swift

print("Enter Name:")
if let name = readLine(){
    print("Name is: ",name)
}

Output

Enter Name:
Sumit Kohli
Name is:  Sumit Kohli

...Program finished with exit code 0
Press ENTER to exit console.
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment