Hello, and welcome to the sixth tutorial swift basics series. And in this part we will be looking at how to add variables into string. Swift provides the ability to include various variables within a string is community. So for example, if you have a whole variable that stores the user's name, when they log on to an application, you can greet them saying their username, like Hello, and then their name. So for Bob, you could say hello Bob, or whatever name they've recorded in the application. It is extremely simple to do they just open up a project.
So let's get rid of this second. So for var, I equals on the put button, and if I want to print that out and do print, and then I can specify the variable name so if I run it printed, I could do multiple print lines, but their print line so there'll be on a separate line soccer we do Hello Batman, hello, and then Batman. But if you want to add variable within a string you do like this quotation marks. Hello. And then the place you want to put a variable do backslash as you can see it's coming up with errors because it's no longer recognizing these two quotation marks in open close bracket. And then inside of here, you put your variable and now I run it and now it says hello Batman.
And you can do this several times. Comma backslash by Hello Batman Batman. It is that simple to add variables into strings. That's it for this tutorial. In the next tutorial we're going to look at how swift handles arrays. If you have any question feel free to message us or support us on our system.
Cody Kay. The email will be in the room. scription you can comment on this video directly message us. All the required source code will be in the description by link. And as usual, thanks for watching and have a nice day.