So I come back again in these three lessons we are going to talk about of variables.
How do we declare variables avoid the static and dynamic variables.
How do we deal with annotations.
And finally we learn interpellation for printing or converting diapers.
So let's go to school and in here I'm going to make you let's make a new playground actually for this
lesson for the next one I will do a new command tool.
So Neo-Pagan all I'm going to call this one very bad is our playground.
So variables to take out.
So let's see how we do.
These are four things essentially variables let's howl but otherwise inter relations and annotations.
Let's see what do they mean.
So for declaring any variable in sway if you have to use the term voucher or you have to use the term
left and then immediately after either of those you come up with the name of your right.
Imagine I want to integer somebody on my end.
Now there are two ways of declaring this to be an integer.
One of them is explicitly telling that there is going to be an int that is voicing column int and let's
say that's going to be 5.
And the other way is saying let my int 2 is 5.
So in the first method you have explicitly used annotation to tell the compiler that this variable or
is constant is off the typed integer in the second one.
You have actually allowed it to defer from the value that you have initialized it from.
My suggestion to you and anyone who is just starting with is always do it like this.
So you know what you are doing.
So if you're going to ever open a string let's say let's apply a string string that says Hello.
So this would give you a lot more confidence at early stages.
Of course you could also rely on the naming that you are using but a lot of time that naming will not
be like this.
So for instance you might have something called a username and then that doesn't necessarily tell you
that it is of the type of string.
It just tells you it is a variable.
So I started a string and then I'm going to introduce an empty string for instance.
At this point so so far we saw are three things we saw what are all variables.
Variables are the values that you want them to change in Objective C terms you can imagine the value
bet is something like N.S. a string y Let which is a constant is something like an S mutable string.
It's about the mutability of the values of course.
So the next thing you have to talk about is the annotations.
How would they print these values.
So I could go ahead and say print.
And in my print I would say print my string.
And that's something that you know you have seen before as well.
So if I execute my play and art This one says hello and then that one says hello the way we expected
it.
But how would they print my integer.
How would they do the formatting.
Now for my thing in is a lot easier than what we used to do in Objective-C in Strief you would only
do this you would say I want to get a strange result.
I want to do an interpolation.
Then you say for one of the slash privacy's practices in your practices you type whatever you're trying
to get.
In this case my ins and there you have it it prints five.
So for instance I could say My aunt is as usual put a column and then do this little format and then
say execute and it says my intice five any value would be essentially the same thing if not a variable
might float of the type float to be three point five.
Then I would say well print fantasies between the practice Zeitz I'm going to say sorry I'm going to
say quotation marks for a string and then a forward slash and burn practices and my fruit and that's
about that.
So any value would be printed Similarly in here I would say my float is
perfect.
So now that we are here let's quickly talk about two very simple things that actually have one.
So commenting is something you already saw it.
It's exactly identical to what we had in Objective-C.
So you do common things like that.
And finally if you notice you don't need to put the semicolon at the end of your lines so you could
optionally if you like to stick to the same programming format but more and more programming languages
are going towards an era of their semicolon is not necessary anymore.
Swift certainly doesn't need it.
Cosmoline the new programming language for Android development doesn't need it.
So you could just not have them and get used to the format that Swift is by default.
And that's kind of the recommended way by Apple itself.
So that's allotted for variables and Konstanz in interest.
I actually recommend that before you go to the next lesson which is about the optionals just play around
a little bit with these and get a sense of how they are trying to take one of the apps that you have
within the past.
One of the projects that we did earlier on and tried to come in here just the just a valuable part of
it.
So you get a sense of what could go wrong before we go to next lesson and we're going to talk about
the options.
So I see that.