Tuesday, 3 April 2018

Raise Our Common Feature (Leacture -5)

They raise our common feature: and many programming languages raise are going
to be extremely useful for helping us to keep information the organized so
what is a right under a isn't ordered in nature and next collection of
objects that's a fancy way of saying that we can take objects like strings
and injury and put them into a group and then keep their position in that
the group in the same order so that we can refer to those objects by their
positions (Dallas Website Development) we can tell the or a give me back the first subject to give me the
fifth object and so on because the objects are going to be indexed according
to what position they hold in the or a when the way to think about it
they're like was expanding follow folders that you can buy a preacher bills
and you might put your electric bills on the first pocket on your phone
bills in the second pocket mortgage payments of [UM] and so on you have a
preset order and you can put things in pockets and take them out again put



this paper into the third pocket show me the paper that's in the fifth
pocket that's the way that raises work now there's no limits to how many
pockets eureka and have at least and in that, you're going to eat about and a
pocket contain anything that is variable can take a string a number
even another right, in fact, a pocket can be just playing empty and then they
can be assigned to a variable which makes it easy for us to reference a
large collection of information by using a single simple variable ok let's
try and example pulls will open up basic got female to save as and with
called this arrays that peach pile change the title the rays and let's
create our first the tags here now the first and I'm going to create I'm
going to sound to the variable numbers now the way that you finding or a is
wide open parentheses closed parentheses and then said we now have defined
an empty or a and assigned to choose numbers there are no objects inside this
or it's just empty we can put a series of objects in or a hand separate
them by using a, for example, an in numbers poorer common they come up fifteen
common sixteenth [SMACK] twenty-three come and forty to so now I have an
an array consists of numbers and those numbers are always going to stay in the
order that I put them there they can stay in that exact order and that
the way I can refer to them by position when I and to get them back out so
let's try that let's see how we retrieve something from I'll use though
we're going to reference the label numbers because that's what's pointing
to our right from is it and then we're going to use square brackets and
inside these square brackets, we're going to provide the index that we wanted

to return in this case the index will be the fashion that's return what's in
position one but are some of at the end and let's bring them up in our
browser and take a look go back to fire fox and instead of floats that
spring of a race so there it is a return an object to us and the object that
I returned was eight now to wait a minute if you go back and you look wait
is what we would have expected was in the second pocket and that brings up a
a very important point about a raise the just always keep in mind a raise our
numbers starting from zero the first pocket is in next to zero the second
a pocket is indexed isn't it will take some getting used to you have a working
with the rains before but that's how raised work in almost every single
programming like we're not just mph so if we changed our index to be zero
and then we go back and we reload our page will get back the first time
which is for so the first time from his indexed with zero you really want my
sure you drill this idea into your head the first pocket in their a the
first item under the first value has always going to be referred to by using
the in next zero and they said in Iraq and contain lots of different types
of objects so, for example, we can have a mixed type object we'll call it
mixed and inside there will have an array and in that are a let's put the
number six the word fox followed by the word dog followed by another a then
another day will put text and y and z a so you see how that works it doesn't
matter what kind of objects we put in there can be in voters can be strings
that can even the other [UH] pennies valid type of Ph.D. can go(Dallas Website Development)
inside and solet's now go back one of those values let's to go from mixed and let's ask
it for what's in number two but some be our tanks and here and just a clean
this up a bit but one of as well and it also houses it before we go back
and below the page for what is in pocket number three now, we know what
number two should be Riker's we know that they start coming at zero so you
can go down the numbers and say zero one too and figure out what's going to
be in the second position the second index let's bring that up in the
browser and take a look and see if you were right and it return the dog to us
now notice here we've got to notice a rate a string conversion is what's
happening and it returns to us or a.

No comments:

Post a Comment