Programming For Beginners: Learn The Basics Of Coding From Scratch | Cas Van Gool | Skillshare

Programming For Beginners: Learn The Basics Of Coding From Scratch

Cas Van Gool, Applied Knowledge Is Power

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
34 Lessons (2h 55m)
    • 1. Intro Programming

      0:58
    • 2. What is programming

      2:10
    • 3. Installing the editor

      3:20
    • 4. Creating a console application

      2:54
    • 5. The solution explorer

      4:03
    • 6. The Program.cs file

      5:34
    • 7. Variables

      6:00
    • 8. Implicit and explicit typing

      4:35
    • 9. Integers and operators

      5:39
    • 10. Mathematical functions

      6:41
    • 11. Strings

      5:08
    • 12. Debugging

      4:29
    • 13. String functions

      6:35
    • 14. Booleans

      5:52
    • 15. If-statements

      4:33
    • 16. Ifelse-statements

      2:55
    • 17. Scopes

      3:16
    • 18. Input and converting

      5:35
    • 19. Exceptions

      1:48
    • 20. Trycatch-statement

      6:00
    • 21. Game Higher lower

      1:08
    • 22. Random & Instantiating

      13:02
    • 23. While loops

      7:28
    • 24. ShoppingList

      8:22
    • 25. For-loops

      5:39
    • 26. Foreach-loops

      2:51
    • 27. The Grocery class

      11:47
    • 28. Access modifiers

      1:41
    • 29. Creating a constructor

      7:14
    • 30. Methods

      7:40
    • 31. Static and non static

      10:46
    • 32. Overrides

      3:33
    • 33. Renaming

      1:58
    • 34. Where to go from here

      3:47
66 students are watching this class

About This Class

Are you interested in software programming, but don't know where to start? Then this class is perfect for you!

I’m going to explain the basics of programming that are found in any software language. Together we will build little projects like a shopping list and a higher-lower minigame. Through easy step-by-step exercises you will quickly learn coding! After you complete this class you will know how to use the techniques for your own projects.

The following topics are covered

  • Variables
  • Debugging
  • Strings
  • Integers
  • Booleans
  • If-statements
  • While-statements
  • For-statements
  • Lists
  • Foreach-statements
  • Methods
  • Classes
  • Overrides


Image credits

Monitor icon made by Freepik from Flaticon

Smartphone icon made by Freepik from Flaticon

Smartwatch icon made by Phatplus from Flaticon

Television icon made by Freepik from Flaticon

Web icon made by Srip from Flaticon

Assembly icon made by Freepik from Flaticon

Worried icon made by Smashicons from Flaticon

Transcripts

1. Intro Programming: welcome to this story. Oh, program before beginners. My name is Chris McCool and I'm a sofa engineer from a melons. In this tutorial, we're going to build many different applications, which will introduce the basic old Cecil programming to build. These applications were going to make use of the programming language See Shop, which is made by Microsoft. But don't you worry? These concepts we're going to talk about are the basis for many different programming languages. So let's take a look at what concepts we're going to talk about. So the first goal says we're going to talk about valuables, which are based for programming, then explicit and implicit type. Of course, we want logic in our applications and to do that, everything use if statements. But there are also many more concepts like try catch while loops and four loops that we're going to look at in this tutorial before we stop programming. Let's talk about a programming, really, is 2. What is programming: So what is programming? If you look at the definition, it is the process of writing computer programs. Well, that's kind of obvious. But what does this mean as a program? And you actually give commands to a computer about what it has to show to our users or which data has to hold. And we do that using a programming language. The's programming languages like C Shop, which we are going to use in this tutorial, will get out or translated to machine code. A machine code is salting. A system like computer tablet or any holder defies can understand basically everything you use on a computer. A tablet are phone or on the Web is made by someone is made by a programmer, so absolutely Airbnb Warm Spot boys. But Windows and Fortnight's the most popular game at the moment, her own made by programmers. There are many different programming languages to build applications with, and there are also many different devices to build applications for, But even things like an automated airport car cell is programmed by so long. So here's a list off a few of the most no programming languages, like Java Ruby See Aydin which is relatively new. See Shop, which we are going to use C plus purse each be and job scripts. And these lawsuits are for reprogramming. We're going to UC Shop, which I already mentioned. It's made by Microsoft. It's a relatively easy programming language to learn, so it has a low learning Purvis. What we call it, the language looks a lot like Java, which is a real popular program language Rich can benefit if you're really into beckoned programming. And it's opiate oriented. Which means that our programs are organized around data, which makes use off course. Epps like classes. The lifts off programming languages I showed before are all object oriented programming languages. 3. Installing the editor: So let's take a look at setting up our environment and to stop programming. The first thing we need to do is to install a good editor. So what isn't Editor note? That is a text editor in which you can write documents. You could write code in these editors, but it's not really efficient. You wouldn't need external programs to compel your code and see if it's working. That's why we're going to use Visual Studio 2019. This is Editor, which is made by Microsoft, and it's built to program. She shop more efficiently, so let's open about browser and look for visual studio. Be typing in visual, studio and press enter. And as you can see firsthand, we get official studio adult Microsoft Up That's Click that and let's go See You have tree products. Yeah, for your Studio of STD Goto. If you just did your foot. Mac, if you're using a Mac bound to write well, if you're using windows, you won't have left home. You have multiple options. We will go for the community addition, because it's free for the professional on enterprise, you have beed license. Of course you're free is a use visual studio code. It's also supports development for C Sharp. But in my opinion for beginners, I would start with visual studio Click on this file you just downloaded on just full of the wizards, which will help your installing the program. I really installed finished video, so you might want to posses feed you until your goal installing installed for your studio correctly. Eventually, it shows this window. It's a little bit different because I've got thes check marks already checked where yours will be empty and at the right boat, it says. Modify where it's Bill say install. So what are we looking at? Officials Studio on DSI shop? We can make many different kinds of programs. We can make weapon club programs. We can make programs for Windows mobile and gaming, and also some older tools. Also, you use beytin. The Game library, which is based on C Sharp, is called Unity. It's just actually on external program. You've also Dicks Emery Framework, which lets you build cross platform mobile applications. PFC shop. This means you can ride a mobile app and see shop, and you can deployed on IOS, Android and Windows phone, which is quite interesting. If you school further down, we're actually going to see the module we're going to insult. So if you could see right at the bottom is good enough. Core cross platform development. This is a library made by Microsoft, which lets you build applications for windows, linens and neck. But there are also many other benefits through this library. So click in the top right corner off the bunch ill so that the check marks appear on President stole on. When you're doing selling, I will see you in the next video. 4. Creating a console application: now read it there is installed beginning to create our first project, and this project is going to be off type was old application. So what is a console application? Probably you have seen this black screen before is called a among brooms, and this is the user interface off our puzzle application. So it's kind of fled. You only see some text on only things we can do. It comes old. Application is right from our application to the console on Give input from the console to our application. So it's very simple when everything's installed correctly. You should now have this window open. And this is the starting window Official studio today as 19 on the Left appreciates er most recent vortex bed because we don't have projects, there are no recent projects. Then on the right side, we can get started on it gives us five options going or check out code on. This is something beyond our core. So I don't mind that. Then we have open a project, a solution which you can use to open up on existing protect. You can open a local folder which is at the rectory on your computer. You can create a new project which we are going to do, and we can continue without code. This means it's going to open up the editor without opening a project. So let's click on Create a new project. This is going to open up a new window. And, as you can see on the left side, we have recent project templates on On the right side, it shows all kind off protects type. Of course, we're going to make his in coastal at build Net score. So the Tokyo on at the moment, But we're going to search for you using to Fielder. So that's open up the language called the box. Then it's concede there are all kinds of languages you can use, but we're going to U C. Sharp. Then he opened up the platform coma books, and we're going to leave that at all, not rooms, and then the type of project is going to be so. But as you can see, there are many types of protects because I've installed more modules, it shows two types of projects on my screen. Uh, make sure that you have the guns a lap. If the build net core it shows that it runs over Meco ass Windows. Linux on more. So let's double tap. Dad, they're going to give it a name and I'm going to go on my first project and let's hit. Enter on is going to create a project for us. This may take a moment, and when it's done, it's going to open up the editor. So this is what the editor is going to look like on. I'm going to explain it in the next video. 5. The solution explorer: So this is what visual Studio 19 actually looks like. And our screen is separated in four panels till we have to navigation bar from the left middle. We have to goto Editor. From the right side, we have the solution explorer. And on the bottom side, we have our diagnostics panel. So we go to close up this pregnancy s for a moment on. We're going to take a look at the solution Explorer goods before we're going to look at a new solution. Explorer, let's first talk about what the solution is. So a solution is unbending mechanism for protects which are related. So we just know create a new project that behind the scenes are after also created a solution for us in which this project resides. So let's take a look at an example solution. Here we have a solution with tree projects and thestreet process can be off different types , so one could be a web protect older library on the older console. The report you can before customers and goes old can actually be for employers, for example. But they all have the same phobic. How does it work is that the rep attacked and a causal. Both rely on the same library because the library has the business logic which is used in both applications. This way you don't have to duplicate code in the two separate protects which will, of course, you less time on. We'll make a programming more efficiently. So what does this look like in the solution? Explorer? Yes. You can see we have a little Iraqi with a top level. The solution which is also called my first project. Then we have the projects. My first project. This is our actual projects where we're going to work in and below that we have something we call dependencies in our program. CS fell. This is very real. Start Cody in the next video. So let's stay open up the dependencies on Let's take a look, as you can see, is below the appendices reacted sdk on. This is short for a software development kit and below that we have to library. We are using dot net core at library and even below Dad, there are the libraries dot net core library users and the most significant one is the system. The halo Rick are going to use his library fairly soon inside our coding, and I will show you how this works. So let's close at the Tennessee step on the problems he has foul is what we're going to look at in the next video. Now let's take a look at the bottom that are diagnosed six panel. Then, as you can see, the penalties now open is the output. We have even more panels. We have our list, the Republic Activity, Goodling's and the Sea Shop Directive 64 Bits panel. For now, we're just going to focus on two of them, which is the output panel on our list and output panel. We can see what the program is actually doing, and they're on the errorless. We can see if something's wrong with our code. That's where your building around this video. We're actually going to take a look at what happens when we fire up the goat that we have now. So we didn't do anything and let's just see where we get out of the box. So if you click on the play button at the top, you will see that the output is going to generate all kind of data, and it's going to open up a bozo in the H B show before and let's take a look at what happens. As you can see, the only thing it does is say hello world, and it brings also supporter stuff behind that. And that's what we call a little grilled application. And what this means is that the only thing it does is Prince Hell world to our user interface, and that's it. So now let's take a look at the code. 6. The Program.cs file: does not take a look at the program. CS Fell Bear. This year's extension stands for Klaus, so actually, the program close and the broom closet is the entry point of our application. So when they present the labour thin like lost video, then this is where our application will start. So now let's take a look at what that looks like. And the programs class and every class fell actually can separate in do sections. The use ing's and the names based inside the using is redefining which libraries we are using, and at this point, we are only using the system A little library. Another word for using is import. So how does this work the Import Assistant library? We make use off the using keyword, and then we type the name of the library behind. Let me end with a semi colon, the semicolon, this comportment because it says to the compiler that this is the end of the line. You will see this chemical in many times during the tutorial. Now let's take a look at the name space. So what is the name space on the face of a billing mechanism in C shop to bundle classes but also older types together. So we know that these are related and you start in the space. It's the name space keyword and behind that the name the name space. Now, as you can see, we have to curly braces here and the opening curly Brace and a closing curly brace. And what this means is that everything between these carry base belongs to this name space . So at this point, it's only the close program. They could make different classes inside one foul so mind. And now let's take a look at the class program. So what is close classes again? A billing mechanism off variables and methods this time. And we're going to discuss what these two are in the upcoming videos. But at the same time, a class is much more than just a billing mechanism. So we started close with the close keyword, and then we type the name of the close, which is program at this point. Then he opened a curly brace on sober below. We also close a curly brace and and the methods and variables between these Curly brace belong to this clause. So at this point, there is only Method B call main inside this class. But if you don't get this all, we're going to discuss this very thoroughly during this tutorial. Now let's take a look at the methods. And as you can see, it is method this multiple, que aesthetic and avoid. And then comes the name off the med. It's after the name between the noble brackets, ISS, while we define us inputs and then will be open a purity bases and grows them somewhere again. Between these curly braces is the actual code. So I know this is a high over explanation off everything, but no way we're going to discuss this very thoroughly during this tutorial. So the steak now Luke had the clothes inside our editor. So now we are inside, are at the Let's go to the pregnancy as far on the right solution Explorer, let's take a look at what it looks like. So, as you can see at the top, we have are using on it imported the system library. Then you have the name space. And as you can see, the names base is named after the name of our projects. My first projects that instead of spaces it uses been scores, then inside the brackets over. In each case, we have the cloths program. And as you can see, the foul name is the same as many of our claws. This is a naming convention, so you can navigate quickly through our solution. And inside that we have a method on then are causal. Right line. Hello, world. If we now fired application Now we see it at this. Hello. World gets bring the dot insider console close now application up again on take a look at it. Good. You can see it at the school's all right line. Has this hell were a teenager? If you change that up So we delete the world on instead of the world's bee type mood and fire up the application again. So we have to wait for a moment for it to compel and check it. There are no errors. Then you can see it says hello, Moon. So what does this go do? Because all right, lying is a class guns old which has a method right lie. And as you can see the full name off the consul ask system dealt console. So this functionality we can utilize to bring failures to our kuenzel, our user interface. We could copy this and based it, and then we could give it another failure. And we say by Moon on when we started dedication. And now it's two sentences L a moon on by moon so you can reuse this council ride line as many times that you want. So this goes old class with the right line. Methods is provided through us by the development team of C shop, and we are going to use many different classes from the many different libraries, and now it's dying to write some code ourselves. 7. Variables: No. Let's start with the real basis of coding variables. So what is a variable? Simply put, it is a name for a storage area. Wimbish weaken Data. This can be numbers or text or something different, but what does this look like? There's a variable named name. It is the value off the expansion ghoul. So let's break it down. We started variable, where to fill our keyword after the bar keywords we give the name of a variable, which is now name or all the worth for name is key and wise is a key because when we use this variable inside a code, it will be the key to to fail you. Yes, and go after the name be used. An assignment operator is what school or an equal sign and behind two equal signs, we actually give the failure that we want to boot inside her variable, which at this point, ISS gasping goal, which is my name, and to let a combine. And no, this is the end off the command we use a semicolon just like with the musings or with our Kunzel right line. Now let's go to our editor and play read these variables. So we're now back in a rather magical see. I did leave the consul right line by Moon, and we only have two. Hello, moving at the moment. That's change this Hello, Moon to get single or your own name, and that's just fire it up again. See if it's showing or not. We already know is going to show up. It's still then. As you can see, it shows Goetzman Ghoul. So all right, let's get going Now what we're going to do ISS define our first variable. And just like in the Bar Point, we're going to start a bit far. Keywords, then Name, Key name on the Simon Cooperator and B type. Here are name between double quotes, so to combine knows that we are typing text. That's a value. Don't forget to semicolon, because otherwise it's not going to work. As you can see when we believe the semicolon the editor is showing is that it actually expected the semicolon and it shows aretz quickly. Line, which shows is that it's an error Now when we fix that on relieve that this is you can see that under the name variable. There's agrees quickly line now on it. Also change the opacity and what this means that we defined a variable, but it's never used. So sitting to his hair, you defined code that you don't use anymore, so you can better lead it or use it. Now the leads, the cash from go inside our ride line and staff. We can use the name variable if you look now, even the editor is suggesting that we are using this name Variable that we just made. So it's saying that it's a strain name and not a far name. I'm going to explain that in the next video. So for now let's kick on the neighbor able on you sit inside our consul right line, So let's no fire up our application on. Let's look at what it does on. As you can see, it's bringing out Castro ghoul again, and this is what I was talking about when you can use the name off a friable as the key. So that goes all right. Line is now looking at the name, and his name has to value vestment ghoul, so it's going to bring out Catherine Ghoul. Now let's define some extra variables we have now good a little decks. Riches are in a variable, but we can also do numbers. So let's go find out for able gold number. And he put inside it the number 10 so far Number, assignment operator or the equal something. And then then and Sammy Kulum. Now let's print that also through the console, using the console right line, as you can see because we aren't using again. There's the green squiggly line under the number variable, but we are going to use it. So console right line. Don't open the brackets and number semi colon. This fire our application again and see what it's doing. You can also press five for running application so you don't have to click on the bulletin Dual time. And as you can see it right, stand to the cause. Also, just as we expected, as you might have noticed, is that be right. Next between. Double quotes on numbers are without roads. Why, this is we're going into in the next video. Now let's do something difference. That's a sign and new value to ah nee variable. So to assign a new failure to an already created variable, we don't need to far keyword. We only need the name and then a Simon's operator and then the new value. So let's put in test. Let's right out through the pozole again with the calls or write line methods. Then just think about it. What are you going to expect? What is going to ride out is going to ride out the first time catchment school and the second time cash ghoul, or is to ride out the first time cashing cool and the second time test. Well, they can just rent it and look how it's working rest of five or pressed the play button and see how it does is going to compel for a moon on as you can see, the result is the first time advice, I guess, for Google. Then it's going to write it, then from the number variable and then test because that's a new value Debbie assigned before we get the causal right line. So as you can see, the gold is going from the top side through the bottom side, and everything you do in between is used at the next step. So our name is test is before the girls all right line, and that's why it will rides that instead of Kasman goal 8. Implicit and explicit typing: In this video, we're going to look at a concept which is called explicit typing. And if you have explicit typing, you have also implicit typing and they both or something different with implicit typing. We don't define the type of the variable ourselves, but we let a compiler make out. Rich. Diapered, actually is, if explicit, typing. We define the type our cells. This means that the combined I don't have to do anything anymore, and he knows what kind of type this variable is. It's also more readable for other programmers, then implicit typing. So that's why this is best practice, actually, So a form for implicit typing is the var keywords, which will be already have been using. But you might already have been noticing ISS. When you're over over a variable, every put a piece of text in because it doesn't say far and then the key off the variable. But it says string the strains of form off explicit typing because of strain only accepts text, but we have even more types can every clause that we can make or use is it time. But here are some primary types which are the basis of programming. So we have string for text kins for number 1,000,000,000 if something is true or false and double for numbers with decimals. But you have even more times. So let's take a look out his works out inside our editor. So let's go back to Ishido 19. So let's take a look at our foreign name. If you go over the key off the ferry bowl, you can see that it tells us something different than far. It's a string name. That's because we put a piece of text inside our name. Variable. Just one goal. The ICTR scenes. The comm palaces. Now this is a very pull off type stream. If you take a look now, at our number variable, you can see it says in. But if you put behind the 10 adult and in zero, which is decimals, it says, it's a double conceded type changes. If what we put into them, it's what happens when we try to put inside a variable, which is behind the scenes, the type off string if you try to put never in there. So let's go to our own, a variable presenter and below that he had a name and an assignment operator. And then, if you look now, there's a red screaming line below the new input into our name variable. So let's hover over this. Then on let's see what it's saying. So it says cannot implicitly convert a type end to stream, which means dead. It cannot figure out how to create a string out of this end, and they're always to do this. But there's no for this. Listen. So what happens if we fire up our application now but doesn't do? Let's hit the play button or press F five to start on. It took a bow and then a window pops up. Let's take a look. The window is telling us from Hey, the building went wrong and what it means by build ISS that it's good and resolve our code . It's going to come Balakot before it's going to bring to check if their errors and it says , Hey, we found an error. The wants to run the goat before that ever happens, or you don't want to rent a code. Your president doesn't do anything, but it will show you in the a release on our and as you can see the same error that we saw when we hovered over 10 hopes up in our era list. This way we can see if something goes bro when we actually try to run our code. So to solve this, let's just indeed, that's have occasional the new value on a very good to go from this point, I want to use expressive typing instead of implicit typing first that's removed that built zero from our phone number. And now let's change off. Our keywords do the actual types they are. So instead of far name that's used string name, and that's used instead off number used in number. This way, it's easy to understand for other developers. Might they use your code? If you press play now, everything will run smoothly on. Everything will work again, but it looks a little better in my opinion. 9. Integers and operators: in this video, we're going to talk about interference on operators. So you might wonder, what is the integer then? We're actually already being using it because integer is the full name. Operators are symbols that are used to perform operations on Operates on. This might sound a little weird. You have already being using Rome, and that's the assignment operator. This operator you used to set, asserted invariable, wait a certain value. But we have many more operators. And when it comes to number, the best No. One is, of course, the addition operator on Let's take a look at the example and what's happening here. So what we're doing here, ISS reset of able number with the number list then and how does works is that we've taken number. We had them to it, and then we said Number with our new value. So the old one first then. So it's quite simple. And of course, after the addition operator, you have the subjection operator, and this example is somewhat the same. But now we're subtracting them, so the new value is the old value, minus then various, also the multiplication operator and the division operator, and as you can see the multiplication operator is a star, not X or something. And now let's go to our code on Create some examples I first go to start, but the leading everything but the number variable testicles, a ride line with the number. And then I go to a few examples off operators. We're going to look at what is happening to a number variable so that start their press, enter and now I'm going to say abstract five off our numbers. So we say number is number minus five. And don't forget your semicolon because otherwise it's not going to work. Then we are going to write this to our council again. Then the next step is I'm going to use the same number and I'm going to dine deaths by seven. So number times seven. And I'm also going to write a stoop Ozel. And the last step is I'm going to take this number and I'm going to divide it by them. And I'm also going to write to student loans. Ole So the division operator and then at them on we have that almost and then don't forget your semicolon. And I said said, I'm going through right days to tickle ZOLL, and maybe you want to play bird and right away, or you want to think about what the real sales are going to be. But if you're sure that's just press this play, But, um, and when we press play, Burton is going to build a bow on it. You'll find any hour. So here are the results. So is this what you expected or not? Let's take a look at what we did on our retail's so, as you can see, reset on the bike then. So the first results right then the subjects. Five. So the result is five. Then we know the blighted by seven a vicious 35 and then he divided it like them. Mr E. Train the halls, but it is tree. So why is this this? Speakers we are working with end and bill round automatically. The number two a number without vegetables and tree and 1/2 will be translated to tree, and you could fix this by changing the end number two a double. But let's take a look at something difference. Maybe you already have noticed it bared at the assignment operators off our subjection, multiplication and division. You can see three tiny belts under our scientist operator. It says. Use compound assignment. It also says, if you wanted to get potential fixes breast control, thought or all tender. So let's do that. This will open up a tiny menu and we can say US compound assignment. Very press enter. It changed the way our suppression, this looking. So what did it do? It took valuable number, and before the assignment operator, it added a subtraction operator. And then behind that directly the five. And this is what we call short syntax for the same statement before, As we can see now, every changed back says no, per subtract is five. Okay, so let's do that also for a multiplication operator on our division operator. And we've also on other Syntex rich Michael Mann handy in the future. This is the syntax for adding only one through our number, which is number plus plus and then our semicolon. And if also for subtracting willing, Chris is number of mines, miners semicolon and this right is to weapons or whether comes all right line and this take a look at the results. If everything is still working fine and what the's lost two statements are doing, so let's press it five to switch it up a little. As you can see, here are the results. So let's take a look at what we did on the results. So again it's at it. Then it subjected. Five did a time seven and it divided by then. But it's not treated no gene half. But these last two statements, we added one riches are four and we subtracted the ball, which is a three again. And don't worry if you don't get, is it? Wounds were going to use as many times over during its story. Oh. 10. Mathematical functions: So in the last video, we used operators on integers and now you might wonder. But hey, how can I do a power with my Inter or the scrap both of my major and probably you're not wondering that we're still going to discuss it. We can do that using the built in system and moth close, but something I want you to learn as a programmer is when you start goading, don't do everything yourself. Sometimes there is a quicker and better solution when you just go to look on the Internet for how other people did it. But for now, let's just take a look at what our would have looked like if he would have programmed it ourselves. So let's say I want to end with a value of two to the power of To might have programmed it like this. So very simple. I have a far eggs is, too, which will be ends on then, before I, which is X Times X, which is for which is the power of to. But now to think about. But if I want to the power of free or 45 well free is going to look like this, but that's just wonder. If you would like to The power of 16 are going to program that yourself or I account to use a tool or something. Of course, you could build a Medic laureate. But what if there is also ready something there and for the square root? I don't have a really good way to program this, so I'm just going to set a question mark here. Let's take a look online at what there is, so let's open up a browser on. Just look for C Shop. Square roots are something like that, and first hit that's going to pop up is probably too right on. So let's take a look. This could see atop the Four Peaks NC shop, My glass and the square with Method is a meth classmethod, which is used to calculate the square words over a specified number. So let's just click Dad and again receive explanation and below that receive off the methods on the mouth Close looks like. So it's public static and then somewhere wish. And you know that even if some example so the meth built square roots and and the breakfast and then 81 inside will give us nine. And if you do minus 81 it will give us not a number because he can't square roots off negative number. So what I want to do is to take a better look at how to smelt that there's working. Let's go back to our bottom point for that. So here we have a square would met it. So far X is meth built, squared and then we put in 80 Wrong, which will be nine. What about this Is math been squares on, just look like And on the website you sell that ecstatic double squares and then some breakfast double. So the first keyword the public is an excess modifier and the second keyword ISS aesthetic modifier. And I'm going to explain these later in this tutorial. I want to focus on what's behind these, and then you have to double and his double is our return side, which means that out of our scram with methods will be a number which is of type double and the square which is the name and then we after imports, which is between normal brackets. So we have one in boot which start 81 at the moment. So I'm going to explain this a little with further so you might really on the stand here We have a mass crammed with books I'm going to call it. And between our backers behind the name is only you want variable. So we only have one input And I had a method only returns always one objects. So they put in 80. Well, we get nine because that input is off time. Double the 81 has to be off type double. But you can always use the end instead of a double. And because dopers before the name of the medicine we know that what comes out of it is also a double. So the nine is also a double on this. Take a look at the power method. So this method is called wow and you have forgiveness. But aesthetic. But we know now that the return type of Mefford is a double have you have to in boots, double bass and double our The base is going to be number. They're going to do the power. So we have to on dude about free Richfield. Two times, two times two, which is eight and we noted space has to be off type double, and also this power off type double and ate that it's going to return is of type double. Now don't worry if you don't understand this at this moment, I'm going to explain methods later on in this territorial. Much more specific, not. Let's just use the moth close in code and see how it's working. So now it's just press Antal, not the work of our last video on the second look at his mouth close. So if he typing math, you can see that this class pops up in our suggestions. So let's pick get on can be type of dog, which means that we're going to use a method on this class just like our Kunzel thoughts right line. And as you can see, a few Tep three times down, you can see the square, its methods and the tiny description off the method itself. So, just as we saw in our problem and double mawf, burn, scratch and then all same book double T. So let's step enter on every type in 81 and then Aceh Michael in bit. We don't have certificate to assign it to a new variable. That's just use double eggs, and I'm going to write as to our console again. So it was all right line and then the x variable. And I'm also going to do the power. So to the next line, I'm going to sign it to a double. Why? And I'm going to use the math told power methods on here you have again description, which is double meth power and then expects to doubles, which I'm going to do to and tree. So I'm going to go to write that you are pozole on. Let's just fire up our application by tapping the bottom or breasts five on the see if is working as expected. Malcolm Malcolm bow And as you can see, that lost their numbers are nine and eight, as we expected. We're now going to have some fun with strings 11. Strings: in this video. We're going to take a look at strings on. I don't have any bar boy for it. So we jump straight into the goat. So normally we deleted. It goes from our last video, and then we're in our main method bird. I want to keep our programs in check. So we're going to do is at a new project to our solution. So the way we do that, IHS, we go with our mouths suit a solution in the solution Explorer on be right, kick on it. And then we go to add inside our menu and we take the option new projects. When we click on its we get our result again for creating a project on we choose to build in its core controller. And I'm going to name it strings and press enter and looking a tradition explore. Now we can see that we have two projects now inside a solution. The default clause, which is created for both our project, is the program she s on on. Let's close the older wound so we don't make a mistake when we're coding. So now let's define some variables. The first variable I'm going to define Hisa String first name, and I'm going to give the value of my name gas on instead of the hello world. I'm going to write my first name failure to console. So you know, I pay for his name and I'm also going to define my surname, which is Fang Ghoul. And I'm also go to write that through the girls old So goes all right line and then surname and thats fire up our application. So I'm pressing at five. Let's see what happens. As you can see is fighting about our water application Know their strings projects. So if we look in the name after a play button, you can also see it at it, says my first project and not strings. So let's fix that. We right click on the strange project and we set it aside to start a project. Now you can see that they're not flavored and it says no strings. Mary ticket. Now it'll compile are strange project, and as you can see, it says now, guess and Bengal. Now the next step is to ride out are fooling, So guess Ron ghoul, or you can do that by riding you just like older values. But I'm going to use operators to help us with this job. So this center and feeling straying full name and I'm going to set to full name with first name, bless to surname and I'm going to write a student. So let's see what the result is. Service fired by pressing us five because you can see the road out cash from ghoul but the gas and defend our destiny. Children. So what this plus operator is doing or the addition operator? Is it a touch the second string that record the first string? And that's why there is no space between them. So to fix that, we can also add a space between them. So let's close the park console on. We go back to our full name and behind the addition operator. I'm going to add a double quotes if space between them. So we had a tiny stream, which exists only over space, and then I'm going to add another audition operator. So now it says first name bless space players surname. So let's fire it up again and see outstripping. You can see, you know, rise castor and cool. So this a way to do it. We actually have a better way, and this way is called string interpolation. So let's take a look at it. We close the park in Seoul on Meet the Needs. This failure after the full name and the next thing we're going to do is type a dollar sign and then open double quotes and closing and what this makes us able to do. ISS UES Curly braces We can now type in friable names, and it will brings the value of that variable inside Destry. So this type of girly brace on first name Yeah, a Space Parodies brace surname. It's fired up and take a look at it, sir, it's going to compel again on Wait, wait, wait On. As you can see, it's still working. And the nice thing about straining relations is that we can now add anything to our full name string, and it will print hours the right way. So let's add full name double dog in space on this fired up again and let's see what saying now. So it's going to compel again on esque a scene. It's now full name Biblical Kesri. Cool. So that's really nice. Now let's take a look at string functions 12. Debugging: in this video, we're going to talk about debugging and what is deep of it. Well, in C shop, we can use debugging to step through our code so began to accept by step what our code is doing. This way, we can better comprehend what a code is actually doing and how it's working. So sometimes when you have really complex growth, you can't explain why is doing what it is doing. And by D booking the code, you can actually see what the code is doing. So let's take a look inside our projects and the step through it by using Deep Army. So the first thing we have to do to let our visual studio no. Whatever you want to debug the code setting a break point and a great point the else Fisher studio that's read the coast reaches this point. I want to take a look at it, and I want you to stop, and I want to step through it so we could find a great point by stepping left from the road . Numbers on the sidebar and it's can see our red built appears. You can create multiple break points. So so we can start debugging and different positions, but I'm going to start with just the top, Wall said. I'm going to click another time on the second door on it will disappear and let's just ruin it. Go. Let's take a look at what's happening so that step to stop it in and it's going to go about stale. But there's also older things happening, as you could see in our consulate. Up there is nothing there, so I didn't write anything out. Nothing off our entry console right statements And on the left side you see this yellow hair? Oh, this yellow arrow. Any case, Rev er, without debating. So at this point, we are at security brace old. It's upside. And now we can hope for over variables on take a look, what's the decider and will be over over the name variable. You see that? It tells us no. So inside of name variable is the value. No, and valued no is the same ass. Empty is nothing. There's nothing there. You over over the number of able it tells a serum, and this is because the combined already determined that they're going to be a number inside on number variable, and it's not going to settle with no but the number equivalent, which is zero. So now when we run too deep burger code and step through it we have from the left upside navigation bar. So buttons death became years. So to see the Red Square on Peace Arrows on the right side. And let's start with the Red Square, which is the simplest form on this just stop deeper game. So it's going to stop the whole application. We can restart, sir. It's going to restart application. Next one is show the next statements that we aren't going to use. And the next two is one step we are actually going to use the most, which is step into and step over and step into ISS bread. Me are going to be back methods. Then we could step into our method on. We are going to use this data will in our tutorial. I mean to step over. Let's go to step over the statement. So if its method that just go to excuse the method, if it's studying a variable, it's going to set the variable in the vehicle issues now step over so the old KIIS Lefton, and that's just step it one time and see what's doing. You could see it stepped through the next line. So now off our name is grasping Gulas yellow. This means that didn't process it yet, so let's do it and not a time. And then you over now over name. You could see that the failure ISS guessing ghoul. So as you can see that everything that's Ah, both are yellow line. His process and the other line itself is not process yet. Then when you step on the magnifying glass next desperate goal, open the shop. Another window, which shows you the value. What's inside are variable. Let me open up now are console window. You can see that it still didn't write anything to our console. Any press f 10 again it executes statement and that you could see gasman. Google now shows up in our console window, so this was a dining enter into D bumping. I recommend that you stepped through the whole application so you can see how it's working and we're going to use this and many more 50 years when the course gets a little bit more complex. So I will see you in the next video 13. String functions: I wanted to take a moment and also talk about string functions. And before we dive straight into growth, let's take a local line and what straying from she's are. So we type in C sharp string functions. Finn, I'm not going with first it because I already notice. I'm going with fourth vicious, complete C sharp tutorial. And as you can see, it gives us a list or functions. We can call on the strings we already created. And I'm not going fruit him at this boy, But I just want to show them on. You can look at yourself now. I'm going back to code. I'm just going to show a few so below the Gobi already created. So the 1st 1 I want to show is really simple. And it's the first girl to upper body does. Is it uppercase everything or string? So let's start by their finding our string full name upper and I'm going to set it with the full name and then to upper methods. And I'm going to write us to our kuenzel again. Of course. All right, line on, then. Full name upper, and something to bear in mind is that This method does not change the actual continents off our full name variable, but it's going to return a string that's the upper gaze very in off full name for able, so you can assign that failure through another variable without changing the full name. Variable. Before we start the project, I want to use another method. It's all my full name shame, and this is the substrate method. So we define a string substrate. We're going to set up with a full name and then reaches the substrate method on what this substance method does. It takes a certain set of characters out of the string where we call it on and redefine where they said is going to start on how long it ISS. So let's pick it. And what I want to do is take the full name barred out over full name variable. And to do that, I'm going to start at Index one. We had a length off eight because the full name has eight characters and I'm going to write it to our causal again. And after that, let's fire part protect and take a look at the results. Sir, this may take a minute with combining Again. Come back, um Balcombe Bow and have to Walk Project. So that set off a strange protect. Asked the started project by right clicking it and said to start a project in this fired up again. Let's take a look at the results Balcombe l on. As you can see, upper gays did what it had to do. So everything is uppercase now, as we expected. But if you take a look at our substrate and something is wrong, as you can see, it's too full name and then the double built so they didn't take a full name. And this is because this sub straying constant start has index zero on the index warm. So that's close of the application on this changed at all, and that starts the project again on this. Take a look at it and is not firing up on. That's because I didn't close are close a window. So let's close that and fired up again. What you see is compiling on now. It has a full name, just as we expected. So strange starts from zero and not from the index of wall. Now, the next thing I want to do is take amount of digits that is inside our string and bring it out. I'm going to define a far named amount of digits on why I had to find a far ISS, because it's easy sometimes. So we're going to set it with the full name and the length. And as you can see those is that it's going to show. Is that amount of characters inside string? So let's print that out to our goals all again, we're going to use an explanation on we go to make a nice text about a day just double dog on. Then Curly braces every type in variable that we just created, and that's firing it up again. And as you can see it, they'll is that our Tony to Data's inside our full name for Able. I'm just going to leave that I'm going to go did so let's go to get up again on the last ask. I want to look at risk might be a little before interesting his What are we going to do if we only want the lost four characters over certain stream? So let's take a look at our six string method again, I'm going to define a stream, lost characters on. I'm going to take full name again and take a look at the sub string uh, has been see tells us the either name off our method. It says, Well, overload on what this means is that this method can be called in to separate ways. If we open up the records, it has a one off, too, as you can see and every tape up and down without corridors, and it gives us different choices. So long variation ISS we have for Start Index and the length on the second variation is with only a start index, and it will just take everything. Do the ends from the start index. So let's pick that one on the place Where I want to start is the end minus four, because I want to lost for digits. And we do that because the number in the amount of they just variable is the same as the lost index of our string. And if you take four from that, we have lost four characters, and it's always to forget your semicolon on, gets fired up again and take a look at it and I didn't write it to oppose. Also, we close it up, goes the right line, lost characters and that's fired up again. And as you can see, it's bring it out. Cool riches, my lost name. So that's really nice. I hope you enjoyed it. And a second look at the next topic. 14. Booleans: in this video, we're going to talk about billions. So what are billions? Billions are fairly simple. The only valuable you can hold. It's either true or falls. So let's take a look at the definition. You can see we after bull keyword. This is short, So 1,000,000,000 then our name Andi Simon operator. And then we have a key words true and then a semicolon. So this bull named Key is setting true on the same issue falls. We have two false keyword, so this is a fairly simple explanation. But the barrel billions realize in the relational operators, which we can use. So let's take a look at relational braiders and some examples. So the first example is we can check with brilliance if something is equal or not. So the names equal to we have a simple, which is double eagle signs on. We can use it by setting a booty, and with five is then and its five equal to 10? Nope, so the result will be false. This next symbol, you probably know from math vicious the greater then. So we used the grated and sign on its five graded, and then it's a no so the results will also be falls. But we have also less than it's five lesson. That's true, So results will be true. So we have also degraded. Then P equals and the less than or equals better. One that's more interesting is the north equal to So it starts with an exclamation mark and then the equal sign and it's five equal to 10. Yes, that's true. So are variable will be Seth with True Why these relational paraders are really nice. You will see in the upcoming videos. So now let's dive into our code on Let's Play around it billions. So the first thing I want to do is create a new project so our old cortex will be intact. I will close up the strings project on I will right click on the solution. Choose add on a new project. So again, that's big cons, Ola told Nick Gore on Cheers. Next on, I'm going to name the project billions b o l e a N s on. Let's continue on as you can see our project that's created Now I said it is it started project so we don't run the strings projects when we pressed five. Then let's start to find some billions. Don't forget the close of the program CS from the strange project, so you don't get confused. The first thing I'm going to do is to find through its on, just like in our examples. I'm going to create in a Rich is equal to five and in speed as equal to 10. So let's create these in a assignment. Operator is five semi colon. Then it be Simon's operator. It's 10 semi colon, and now I'm going to create a bull named Check. We just go to check if these two hints are equal to the Children. So we started a bull keyword and then the key check assignment operator. And then we go and say a is e. So equals equals. Be cynical. And now that's the leader at the world and instead to be feel, said it with a check and thats fire about application and see what's riding out. So Balcombe, bobbing about on it, says false. So my example was right. So five is not equal to them. And now let's change it up a little. But I'm going to do is I'm going to set a with value a close be so a lettuce B is the short Syntex. Then I'm going to define its new bull, and I'm going to call check to which is a greater than be and bring me to find that Let's also right. That's to our puzzle. So consul, right line and then checked here. I'm not going to fire up the application just yet, because be probably only know what the answer is going to be. Very can also do something different right now. I'm going to set B. If a times two should be gets a value off a times to and what we're going to check ISS that if B equals to eight, I'm suit. This is kind of obvious, but still, that's just do that. I'm going to start with the bull keyword. Then I'm going to name its check tree on use assignment operator, and then I'm going to set a equals equals to be less. Just figure it out from there, so chemical in and what I'm going to do now is on the left side. So where we set a I'm going to set a times to between no brackets. So what are combined, it's going to do yes, it's going to check if a times to ISS equals to be on. Let's right at out to our puzzle again. On goes. All right, check tree on. Let's fire up the application on Let's take a look at the results. So 1st 1 this falls, so five is only built in them. That's correct. Then the second on this true hey is bigger than be because is 15 and beast then on the Second World? Because we said we'd be equals two a time seal on real Italy going to check their If B is equals to eight. I'm sure it's also going to say True So So now let's go to the next video and check why billions are so handy. 15. If-statements: in this video, we're going to create our first beat of logic, and the new dads were going to use if statements. So what is an? If statement on this statement is a conditional statement that performs Kurt Went found true. So what this is going to look like on the If statement starts with the if key words, then behind that be open a brackets with a Boolean in between, and then we open a purity braces on between these curly brace. We put the code that's going to perform when this 1,000,000,000 is found true. So let's take a look at an example Here we have an example. Let's look at it from top to bottom. You haven't a That's to their Indeed, it's tree and you have an if statement that says, If a is less than B, then we're going to perform our coat, which is a pris place, and we're going to write a tour console. So what is the goals are going to write down? The answer is treat because pays lower than be an April splice and is going to write a Gozo on two principal industry. Let's take a look at another example, so from top to bottom in a for in the history efface lowered and be again than April's place and write it through the console again. But this time a is not Celeste and be sure it's going to write four to our phones old. Now we've seen some examples. Let's get goading ourselves. So I returned to my environment on the first thing. I'm going to dio a new project again. So that's right. Click. Our solution had a new project I can going for the goes a lap next, and then I'm going to go. If statements creates or press enter and we have a new project again, let's close the older projector. And that set our new project a started fortune. It's groups of older programs. He s Don't forget that, and that's the elitist. Comes all right, lying And what I'm going to create ISS, a really simple divider application rich. I'm going to have a certain number on another number, and if that holding them is Hyatt in it, then it's long on gets shorted and if it's short, so I go to define two ends in length and then Simon cooperator and I'm going to set it to hundreds on. Then I'm going to define another ain't which I'm going to call the fighter and I'm going to set that to 80. So our length at this point is Loomer than a divider. Then I'm going to define a string results and why I'm defund. This result variable is because of a bone set richest gold scopes, which I'm going to explain nature old in this tutorial, and I'm going to set results with on empty stream. Now let's create our statements. We start with the key word. If then we open up our brackets and as you can see, it automatically has the closing bracket. And what we can do now is fill this if statement if the relational operator to check if length is bigger or equal to the fire. So me after is we can now go outside our records and then open up are fairly braces. And inside here, we can talk to go that we want. So I'm going to set the results too long because our length is longer than our divider and outside our if statement, I'm going to write to our console Sarah Consul, right line on, then result on this fire of dedication and see what it's doing. So you press at five and come back. Come back home. How on this time it's taking a little longer on that. You can see it right out long on. This will be expected because the life has a higher number than defied er. But what happens ran. We lower the length number below the divider. What's going to happen now? What's going to print out? So we press at five again, you can see is road nothing. And this also boot because we never said the result. When the length is loaded, the fighter we don't do anything with results. So it's empty. And for a scenario where the if it's not true that I'm using l statements on let's take a look at that in the next video 16. Ifelse-statements: in this video, we're going to have a quick look at, if else statements. So a conditional statement that performs cause based on Truell falls. So what does this look like? Samos? A. If statement. But now we haven't else behind the closing. Very braise over. If statement and then be open up. I'm not a set of QWERTY base records inside. What's now happening is when the Booty Instru it will execute the Goat Insider s statement . If it's false, it's executed Coat inside their l statement. So let's take a look at an example from top to bottom in a stew. In history, if a is lowered and be Sammy at belong to A if it's not, then we subtract will form a and then we're going to ride it out. So what is it going to ride out? Well, a stew on a is lowered and be so we do a place bliss, which means that they will be tree. Now. Let's take a look at it, not example from top to bottom in age for getting to be street. If a slower than B, then we add one to a if it's not very subtracted from a well, A is bigger than be so the statement is false, which means that we're going to subtract them from a and they will now be free. It's now had back to a coat and implement the else statement. So what we going to do is when the length is lower than the fighter, the result will be short. So else opened up for curly braces and inside it resets results through shorts. So when everything is complete now, let's fire up the application and see what it's riding out. So life slower than the fighter at this point and five or attempted button and is riding out short this time because the length is lower and divide us. O R l Statement works, but the check if it's really working, that's DeBerry. It's just for fun. So we set a great point at our length assignment. Have you read it again? And as you see it stopped, Now we're going to suppress F. Then multiple times we can see about the R code is doing so repressive. 10 of 10 of them. Now it's only if else statement, and it's saying that our length is lower than are divided because it says that the statement this fall's Mr See it jumps into our L statement. And if your best after now it will run the ghost between are fairly braces until set result , it's short on. If we win it completely than in our console. You concede that the result is short. In the next video, we're going to take a look at scopes. Combines result is outside of if else statement. 17. Scopes: in this video, we're going to talk about scopes on to do that become straight to our code. As I explained in the last video, why this string result is created before it's even sat pit of certain value. Yes, because of scopes. So what is the scope? I think the easiest way to explain ISS that every opening and closing very bears creative scope. If you take a look at our static for it may methods, we can say that between opening and closing curly brace for main methods that this is inside our main method. Scope. This means that everything that's inside our main method and below our results very bull can use did a result variable. So also are, if else statements now if we delete this variable, so if we need to string results, then we will see that we get some errors. We fix that by setting strange results Is long stream result is short insider if else, but now we have an error. Very. Take a look at our Brazil's insider if you can see that it's created but never used the same for the result inside or else we take a look at our Quenzel right line. It says that there is no variable named results, and this is because it doesn't exist inside our main method scope. It now exists in the F scope and in the telescope. That's also why we can define two times the results variable, which isn't possible. If it's inside the same scope, Why can't we now use it inside on May? Method scope? That's because if Anel scope are inside on me method scope, that's a name. Endoscope is north inside the heaven hell scope. That's why it's not accessible. Form a method. So if you delete strings now before the result insider, even Els and define it back again. Asylum may method because the result is now both even l statement. And they also live, if each other in the same scope, a main method. So we actually have a lot of scope our class program scope. So what happens where we define our string results? His side, our class program? Then it will be accessible by all methods inside our class program. Above aesthetic Floyd main me to find a new variable String results and an assignment with an empty string really lead it out of her steady for Maine methods. And, as you can see, there are still some heros, is because we have a steady context, and that's something entirely different, which I will explain later in editorial. So for now, let's just put static and food over our strange result to fix this Erler. And as you can see, there are no hours anymore from it. I'm or offend to use a string result inside our main method because we won't used anywhere else. So I'm going to place it back inside. Maybe if it's Sarah below, I divided. Let's bring it back there and let's take a look. That's the next subjects. 18. Input and converting: in this video, we're going to take a look at how we can give in input. He set up programming everything beforehand. So still now be building medication, which we program the divider program to length. And then he said, short or long. But what if we want to decide a length? What if we want to decide who are running application, what the length is going to be? We can do that by using the consul read line. So this is a method will not going to class that we can call Rachel, give us access inside a console to type something in Wistrich and use insider application. So what is this going to look like instead, off the same thing every normally said you can now use to cultural read line to set our length. Let's go to our code and take a look at the schools will read line. The first thing I want to do is notify the user of the year. She can type something into our console, so let's start with a causal right line and we say type in length double, sir Consul right line. And then we opened up a quotes, typing a length tabled up on space or not, because it's actually going to write it on the new line. And don't forget to semi Colon. Next thing I'm going to define far in food and then Simon cooperate a and I'm going to set it with the consul. Read fine. And that you can see here are causal read line will return a string. So this is really important because eventually we wanted to be a hint. Now let's set a D burger and started application and let's take a look at what it's doing right now. So we should see her typing a length and you could see it pops up now if you press F then so if you step over a causal read line, then the debate a real stop, and then we can type in a value. So I stayed ahead, and that's typing some rubbish or whatever you want. I'm just going with FC Chef hadn repress Enter on. If you take a look at our improve for able now, you can see that text types in is set to our input. So that's what we expected. That's what we wanted to do, and every person often again are length, variable will be said and everything will just go. It's planned now. I want to set his length with our goes all red line. So let's just stop. The debug were on. We delete this for imports, comes all red line, and I'm going to set our end length with our causal read line. But obviously we're going to walk into a problem because our council read line who returned a string. So our compiler or our environment is going to tell us, Dad, it's not able to confirm a string through a hint. So we have to read scrutiny Line here on it will manage to go over. It is variable locally. We don't have to do this ourselves. We have something for that, and that's called covert close. So let's take a look. So converting its a principal off changing a certain travel from a type toe, another type, and to do that, we can use the comforts close. So what is this going to look like? If you want to change ends to a strain, you can just go to Converse clause and then we call the methods to string and we give input , very wanted converts. We can do to say for inter chair, but for that we have multiple methods have been through in 30 to do in 16 to in 64 which indicates the amount of storage this end can use on my Deerfield. I'm just going for the 32. You can go for the 16 or 64 whatever you won't, but it's important to know the difference. We can also do comforts to a double if you want, but eventually rightist is going to look like what our consul we'd line it could again define off our import and then set this with a causal, read fine and eventually convert is too and and set off length with the result. There's one way to do it. The quicker way is to directly comfort to end our consul read line and set on length with results. So let's implement this into our code. So let's go back to our usual studio and wrap Our goals will read, lined with our comforts to end 32. So we set our prayers before recalls a red line. Be typing comforts be president on. Then you can see all the methods that we can go. We're going for the two in 32 and every open up a record and behind our calls or read limey close a record, and it's can see, however, this air bad. Now maybe over, with a marks over there doing 32 methods because see a small summary of others, Method is doing so now. Let's fire a ratification, and that's typing a new number. So having a length, I'm going to give in 50. And as we expected, the result is short because it's lower than the 80 or the divider, so that's working pretty good. But now let's do something different. Fire up the application again and we giving a text so not a number and when we press enter is going to show us an exception. Andan exception means that something went wrong while running the application, and this is why we go to talk about in the next video 19. Exceptions: in the last video, we came across an exception. And now let's take a better look at what exception? ISS. So it's a response to an exceptional circumstance that arises about programs running and long. We came across was a former exception and that boss, because we typed in the text, we try to convert it to an end, which are program wasn't able to do. And that's why it showed us an exception. There are many exceptions, and one of the most easy to explain is the divide. By zero exception and the problems here that BF do variables in a zero and B is five, and we try to divide the B I A. On. It's a meth principle that you can divide a number by zero, so that's why it'll show us an exception. So let's just take a local line had both kind of exception that really are. So we feel in C sharp exception this and let's take a look at the results we get on. I'm going to school down a little on. Then we see a page which called completes the shop tutorial on the complete list of exceptions class and see shop Let's click there A C C. You got all the exceptions listed here, and if he's cool down a little, we also will see defy eyes. They were exception. Why it's there. And it's thrown when there is nothing to divide into. Chair by zero, which is not possible, so you can take a look here. You can also just code, and you come across them while you're coding or using your code and fix them. Man, it's necessary. It's not. Take a look a try catch, which is a mechanism to work with exceptions. 20. Trycatch-statement: in the last video. We talked about exceptions, but what can we do about exceptions? Well, we have something which skulled a dry catch statements, and this is a magnetism for exception. Handling the try great statement gives us the ability to react when one exception arises. So let's take a look at an example, so we may understand how it works. That's why catch statements starts with try the worth and then opening purity braces and between the curry braces we political that we think might raise an exception. Then the second part of a tribe guest statement iss the catch and in a guest redefine a code that we want to use when a certain exception arises. So what was the first statement? Looked like? We start with a catch keyword, and then we opened up brackets. We defined exception that we want to get Minute bob, sir, as you can see, reuse the exception class and not the form of exception clause with the fiber zero except in class. And what this means is that we want any exception that arises in narco, that we are money throwing inside a try statement than inside the coat over catch. We can use this exception to check what the reason is wide exception popped up. What we can do with that is, for example, looking it so we know that something went wrong or user experience something that didn't go rights. And we can monitor how many times takes place or why it's even took place. So that's quite handy when we trying to optimize our application. What is this going to look like in our code bill? We're going to check for four month exception instead of the exception, and we're going to define our in life and conversion script. Inside are try. So when someone failed something in every good and convert, this four month exception will catch it, and then we can do something with it. So let's go through our code on that's just built this and let's take a look at how it actually works. So what we want to do is this. In playing Fulford script inside are trying get statements, so we go to the line above it with a fire try and curly braces, and then we take our lengthy parable and replace inside, try statements, so let's got it away here on basic back in, and now we get an error below it because life isn't defined anymore. Side of May method It is a problem of scopes, which we talked about. So what we have to do is define our end link variable outside of try statement and just use it inside a try statement. So let's set up occurs on both. Try statements on your brains are handling fear, and we set it to zero. And after that, we lied to the ends before our length inside a try statements. Next thing is our catch. Statements on what we're going to catch is a four month exception, because that's the exception that will arise when diapers something in there again to convert the name behind our format. Exception is the key that we can use to excess data inside. Our exception variable. So when we want to see the message, weaken defines E X adults message. For now, let's just write a council right line that says, Hey, that's not a number. So when now an exception arises, it will ride to the console that it's not a number, and that's put a break point inside a try statements so we can see how the program is working. Now let's fire up the application by pressing five on. We will see that it will now stop. It's the beginning off. Try statement. So it's compiling and our interface opening up on a scan. See, it stopped here. Received a yellow indicator every game present after now and another time, and now we can't feeling something. So let's fill in optics instead, number and press enter and let's see what it does that you can see now. Indicator is all market statement, and if you press F, then we get inside a statement. If you over over our X keyword, you can see that there's a message off both. The problem is the repressive, then not a time. And if you take a look now at Apple's Oviedo, it says, Hey, that's not a number. If he now, let's the program continue, it will say showed because the length is never said so. It's still zero on zero. It's obviously lower than 80 so the next step is when we detected that someone didn't feel I had a number, we give them another chance to feel in a number if they don't, it's just super annoying, I guess, to let them know they can try again. That's at a lot of calls, All right line. And that says, Try again double dots. So guns, all right line opening up brackets and double quotes. Then try again. Double dog on. Then we can actually just copy paste the length statement below. Here and this. Run the application again and see what is doing. So I say five or step start, but and then it will start combining again and he pressed do times double left and every feeling up Decks and B and rock get statement again. So if you had pressed multiple times if then, now begin again. Feel in a number. And if you do that on begin, go throughout code and we can see that the number is now filled in correctly. It's still sure because dirty is still lower than 80. But now we have at least a basic understanding off how we can use a try. Catch statements. Of course, there are many older ways to do this, and maybe during this tutorial you will find a better way so you can be entirely sure that I use Orville feeling on number before the good friends, so let's take a look at the next subject. 21. Game Higher lower: in the next project, we're going to build a tiny game which is called Higher, Lower. It's a really simple game where we generate a number on. We're going to predict if the next number is going to be higher or lower, so there are certain steps in this game. First step is that the CPU is going to generate a number between a certain range. Let's say they were end 100. The next step ISS that we're going to predict if the next number is going to be higher or lower than the number that was generated. So we have a little user input here that can be higher or lower or something to indicate that we choose higher or lower. The next step is a computer generates a new number and after that, the bill check. If the new number is actually higher or lower and based on that will show to result, then the law step iss a loop. Actually, when we are rights, then we again predict if the next number is higher or lower and so long until we're wrong. The first steps that we're going to say is the 1st 4 steps, so everything but the looping mechanism 22. Random & Instantiating: The first step for a new project that we're going to create is generating a random number. And to do that we have a class called random, which is known? Asked a random number generator ID A random doesn't work the same as consul or conferred. They're random needs to be extension. Hated. So what does this look like? So instead of just calling the console or the comfort class or in this case, the reading class, we actually needs to create a variable which is of type random, So we have to type random and then the key, and we said it bit constrictor and why we need to the duties instead off your skull, close ISS The way the clauses designs the council and prove Earth claws are aesthetic. This means that that there will only be one off them. And the way the random clothes designed ISS that to close the blueprint who can create multiple objects is what we called it. From this class and ends, blueprints can be decided what type of data that needs to be created and what type of data can hold end with kind of logic. This object has so the best way to describe a constructor is a contract, which is Germans, while data is needed to create an object off this glass. So to make it more clear, let's go through some examples instead of only Dhiren DM. So the principle is called instance creating, which is creating an object of the time. So we have Here are close cones over which aesthetic and when we called the Kunzel read line or right line, you're always talking to the same instance off this object. It goes with the aesthetic modifier. This object can be created, and we are always talking through the same instance That's just the way to close designs. But now let's take a look at the Notre concept in which our type clauses teacher and for every teacher, we want to know the name on the course and without his data plans, created teacher objects. So what we can do? ISS. Let's say we have to teachers and because he creates these objects and we can set piece teacher objects because of the blue prints off the close with the name and the course. So the first object is going to have the name Peter on his scores is going to be history. The second objective is going to being named Heat if and she gives math and we can design it's this way that it can only be created if the name and of course, and we can do that with the constructor in the random Is Klaus case the constructors empty ? So we have new random and then empty brackets, which means that we don't put any data in to create this object. But in a teacher case, we actually want the name. And of course, so this means that we can only create by giving in the name Peter and of course, history. And the same is for our beautiful checks. Where we givin ead if on meth. So what we can do now is because we put these objects inside our teacher, Peter and teacher it. If we can call these objects and ask of them, will to the courses on wealthy name is so if he asked, teacher it if the name it will give us back eat. If if he say teacher Peter Adults course, it will give us back history. This way we can bundle variables together using glosses and it's blueprints to create objects that can hold multiple variables. And this is a really quick overview off instance, creating and classes. But we will discuss this more thoroughly. Further along in this course, when we are both create are actually own classes. So now let's get back to our random number generator. So we have here. A random generator is new random, So this way we create a random pulp checks, and what we can do if they random objects is goal, affection or methods. That gives us a random number between a certain range. And there's method this gold next. So what we see here is we set a parable ends number with the generator adult next, and they're giving 20 on one hundreds, which means that it's going to create a number between 20 on 100. You can also give in only one number, maybe only giving well number into a pH value between zero and the number that I gave in. So if we say alders, it would create a positive number, which is between zero and 100. The lost option we have ISS don't give in any number on. It'll just create a postive number, which can be 0 100 or also two million. So now we know how we can use a random applause. Let's implement that inside our new projects. And to do that refers needs to create a new project inside of visual studio, open, official studio and less creative projects, which is skull higher, lower. So let's right click the solution. Are you going to add than new projects on the Choose it Consul Abdel Net score and I'm going to call it higher, lower. Let's type that in and press enter. So it's going to create our projects now when the person's created, that's close up. There were statements. Protects who has closed off the program. CS on that set our low protect as to sort of protect. This is let our hello world on. Let's talk by creating our random objects so every type in random and that you can see it suggested as the random claws. And when you hope for over its you see, the summary represents up Cedo random number generator. So let's pick that on. That's called a generator and we said it. If the new G worth wishes tikiwade for creating objects and then the random, tired and then empty brackets because it doesn't need any input. If you look on the left side, you can see one of two feet step because her down you actually have a fair sham breaking giving into seeds, which is going to use if calculating the new number. And you can also read the description below if you want to know precisely about this. So let's go behind our random and empty brackets and said in a semicolon, No, let's use this generator to create our starting number. So I'm going to define into stock number, and I'm going to set it if the generator So he thought Generator and it's going to she chest are variable. So let's big that on very type in adults and that you can see we have multiple choices, which the nexus for ends. We can also choose next double next bites and so on. We're going for the next function. Then, as you can see in the description you see that is going to return a number as between the men failure and max value that we give in has already told you have also one of tree. So the second option is just to give in the next value or we can don't give any failure in at all, and it's going to create a positive number. So we're going to choose the first option and I won't use a number between zero and 150. Forget your semicolon and this. Now create our council right line, which will write out this number. So guns all right line and I'm going to use a dollar sign so we can use interpolation than double quotes, start number double dots and then open a purely brace and start number and close it up and get semicolon like him. Now let's fire up the application and set a break point so we can see both applications actually do it. So it's going to compel, and the first time always takes a little longer. Man has conceived by our re aunt. It's debunking. So if you press f then now how are generated will be created and it says now that itself system random, we can open it up on you can see all kind of rubbish. And if you press everything now again, you see that our start number is said Now we value if you continue to program because that it rode out stop number and then the failure that generated Now let's create a logical became and the first thing we do after we generated a starting number is to make sure that our user inputs value higher or lower. So first, let's do a causal right time, which asks higher or lower, so higher or lower and a Christian bark semi colon. And now we're going to use an input variable so far, input or straight input, which you prefer. And then we go to set it with the consul read line. So assignment operator whose sole thought read line empty brackets Semi colon. Next, we're going to check if the input is higher or lower, so we're going to first check in a statement. If input ISS the same, has the text higher? Seven. Let's create that. We started the f key words, Open up brackets and we check if the input is the same as higher if on uppercase age. And he opened up curly braces and let's do the same for lower. So if input iss lower, then hoping of Curly braces and why I don't use and if else's, because the user can also feel in something entirely different. This would mean that that would always go into the else. The next thing I'm going to do is to find our results parable, and there's going to be a booty in, and we're going to check the second number. So we have to generate the second number and this dude as first. That's creative travel in second number and called a generator again. So it's generator hope next and then again, Sarah and Will not was 50 so it will generate. It's a new number. Now Let's create results variable so you can use for a bull handguns use for this time and then result, and I'm going to set it false. So when somebody types in something different than higher or lower, the result will still be false. Now let's set this result. If the cases have been some of food and higher or lower, who are going to do is results assignment operator and when somebody said higher than the second number should be higher or greater than the first number, then if that's the case that resulted true as they're the same for the input is same as lower, so we can copy this line and base it inside are lower. He can just change upgraded into letter than sign and his last step I want to ride out the years was true or not. So we're going to do a puzzle right line. And then we started Ayatollah sign on, open up, double quotes and then we die Pain. Your answer is double does and then we hope, not a charity brace and then result. Can you call him now this fire of the application on Let's see what it's all doing that step the play button. So it's going to come bow. And as you can see, we started developing. Let's take a close, a window just empty, and this is press F then and see what it's doing. So the first number is Steve Long. We can now press a multiple times after, and we're going to give in our input. I'm going to say higher because there's a bigger chance to It's going to be higher, so that's timed it. And don't forget the capital age because otherwise it won't match. Then we're now going to generate the second number. But let's take a look at it. The chest press F 10 till the hour to result. Now, if you see that the result is true, So the second number is higher than first number, and it's got also go to say, That's your answer. Most true and this is the beginning off our high lower application In the next video, we're going to take a little bad, how we can live this until somebody is wrong. 23. While loops: Yeah, we're going to take a look at the value, and this is the concept that we need to finish a power higher lower game. So what is a well is a look like an air statement, but this time it will execute the defined codes. While the statement is true, this means that man, the code is done. So when we actually at the closing Curly Brace, then it's going to check again if the boudin is true or not. And if that's the case, so if the billions truth is going to execute code again, it's an easy way to create even it. Lupin bowel statements Because men you create a valid that never going to be false, who always be stuck in this well. So let's take a look at an example from top to bottom. We have available called in number on Reset it with zero, and we have a while Loop that says album number is lower than five. Then number bless plays. So we had a bone to the number and had lost. We ride it out through the console. How this is going to work is that then we answer the value. Vallas fair is going to change its statement is true falls. Then the statement is already falls at the start. The while loop is never going to execute the goat in the first place. So when it's true, it's going to ask you, The goats is going to say Number plus plus. So add one to our number. Variable half the dad It's going to check again if number is lower than five on number is now long. So it's going to ask you to code again. So is going to use number plus plus and so on. And so so you can pass a video here, or you can just check with me about the answer is going to be both consoles going to write out. So the answer is going to be five. Why is that is because the Valley checks if the number is lower than five after its increased in number. And that's why, when the value is false, it means that the number is the same or higher than five. We know that the number is five. To confirm this, let's execute this encode. So we go back to our editor and we type out the well statement that I showed as an example . So we start within number. Hey, Sarah. They re create a while. Loop number is lowered and five, you open a purity braces on between a very speedy find number plus plus semicolon. Damn, it goes Alright, lying our number available to our console. Before I start application, I'm going to put the break points whom line nine, where every creates in number variable and that's pressed play bottom. So the deeper is stopping at a break point on. Now we can press f, then on we can see it at on. Number is still lower than five. If he pressed in again, then it's going inside. Our value is going to increase our number fable and again, it's going to say it's true. We can look truest until the statement is false. So that suit at spread if then this check the number of able it's now for is going to increase our number. And now number is five, and it's not going to be lower than five. So if you press have 10 again, is going to skip the value it's going straight to oppose. All right, life. Now look to our Kunzel is going to say five, which is as we expected. Now let's close up because a window on this elitist code again, we have to stop the application to you that so when the application is stopped, let's elite are example code. And let's think about how we go to use this value insider application. So the statement place is going to determine if they were a loop is true about ISS are result variable, and that means that we needed in our main contacts so in a major cope. So let's replace this so that we can use it inside of al Lupus fellas outside it. Then the next thing I'm going to do, IHS said, the results to true. So as long there is no answer, the result is going to be too. So we know that Ah, well, it's going to wrong. The next thing that we have to do is define our well, and it's good that I want to place inside our value from the line, very ask, higher or lower to end off our code. That's because in the end, it of being true or false. So we ended up being true, he runs the causal to ask again if people want higher or lower and given input. We want to generate another number and then we want to check if the next answer is also true or not. And at Los, we actually have to set the first number, so to stop number with the second number. So this is going to be the new number that we check against. So let's define about we start with the well keyword and then he played inside results. They're bigger. Parker could be placed inside of Allah. Then he noted code that we already had, he said. That start number is equal to the second number, so when it's going to loop is going to check against newly generated number and when we have done that as fire of defecation. So we're going to start out if the number 88 and the biggest chances that our number is lower than 88 so let's type lower. But before we do that, let's set a break point so we can check what's happening. So we press enter man, that's f then on, as you see on number is higher. So the overall which means that our code isn't going to loop on his just going to continue and stops. And as you can see inside, Gonzalez says, there are answer is falls and a program should. So let's try another time on this time. That's her bad PR. True. So let's close the application on Let's Run it Again and let's take a look at new number creatures one on the 21. So I'm going to say lower this time because I really think it's going to be lower and press Sefton on a number is actually lower. So is going to loop if we're rights. So our results true and our answer is through. S agency is now checking our results. Still, through Anne's go to loop again. So we actually see now again aside, a console higher or lower. And this time we actually would say I are lower. But but you can see the new number did pop up on Arkan's Oh, so if we didn't debug, we actually wouldn't know about the next number was going to be. So Let's fix that by console by lining our number that generates to check against to console, so calls all right. Time Then we use a dollar sign. Opened up. There were quotes, then the number boss and then double thoughts and then reused inspiration to write out the value of our second number. And don't forget your semicolon And this way are high. A little get and should be finished. So I recommend you to play around a little with the girl. Let's just run it Looked through it. And Rio don't hope to see you in the next video. 24. ShoppingList: the next goal said that we're going to talk about our lists. So what A list A list is a type invest. We can hold multiple objects off a specific type in order. So basically looking example on, we're going to build in the next few videos. A grocery list application. So what's the problem in this case? Well, we don't know how many groceries are used once to define. If you do this, really, we have to create for each grocery available, and the problem is that we don't know how many variables we need. That's why it's better to use a list, a list of one variable in which we can store multiple objects or strings or billions or whatever you want. So how does this work? You have a list with diamond text stream, which to the type. Of course, we switch sticky, and then we have a new list string and then brackets reaches again. A constructor. In this case, it means that we have a list which is a close process and type string, and how does this work? This means that there can only be strings inside this list, so no billions, no numbers no random know anything. The type that is fine between Diamond Tex determines what kind of parables this list will be holding. So let's get into a code, and that's create shopping lists. Vortex. So we're back inside her editor on Let's Create a new Project Inside of Solution, which is a little family press Next, and then I call it Groceries List this close of the other projects on the program CS and that set up grocery list as the starting projects. And now we can start Goody. So let's start by leading a school. So right line Hello, World. On the first thing I'm going to dio iss defining our list. So as you can see me topless, we don't get any recommendation. But on the left side, you can see that we have a light bulb. Which means that the editor is trying to do is a suggestion. So let's click on it. It says that we can fix our error by using the systems the collection still generic. When we do this, you can see that our list actually changed color to the green Golan, which means that it's a clause. Now we open up the diamond tax and we say string because our bro, she's hot for now, just going to be strings. You go up the groceries and then we use the silent Liberator to senator. It's the blistering constructor ritual pH for us, a blistering object and forget chemical on to the next few things that I wanted there ISS creative program that gives us the choice to add new groceries to our list. And to do that, I'm going to start with a Boolean reaches called Done. I'm going to give value off falls. So let's define it. Julian and I don't Simon operator. It's false, and then I'm going to use it this side of a while loop. So I'm going to use the well, a keyword and an open of brackets on defined only excited. But as you know, it isn't going to work because our donors already falls and this way it escape our jalape. But when we put an exclamation mark before bullion is going to invert the bullion, so when it's false, it's going to be true. It's true, is going to be false this way, when darkness falls, it will still be true for well the next thing I want to do it. This made the user where that can type in a grocery. So that's at a council right line and then says, Type in your grocery People thought, And then we define our input with a causal read line. But first, let's through this council right line, so happy and console the right line, as we already did many times before. And then it says, Type in your grocery Devil dogs on the semicolon. I remind you of this because it's really important. Then go to to find in blue. It's so strange, input at and console read line. And the next thing I want to do is actually at this input to our groceries list. And the way we can do that is be typing groceries type in adults. You can see that all kind of methods on this list object, and one of these methods is the ad method, and if the admitted we can add a new item into a list, so this is the one that we're going to use to add his input to our list. The next is Dick Pound on this card is set by the amount of items that are inside a list, and we have the clear in which we can clear list. You have to add range where we can actually add a list to our list before each. Which something and finally different on. I'm going to show you in a few figures. But let's chooses ads, and that's at this import to Alice. Next thing that I want to do ISS to give our use on option if they wants to add another item or not. So we're going to ask our user if they want to add another grocery. Did type handle? Why? Then they will be able to add another grocery. If you type in the end for no, then that issue will stop. So they're not a grocery high for yes and for no get your semicolon. And then we have to create an statements page when they type in the end, and I dont is going to truth. So we used the if keyword can be opened up to quotes on bond, and we said that through equals input. If that's the case, then don't is going to be true. Good that's in for it is because it's more readable if you ask if in both is the same as an handle tailed away around. And now let's set doing to truth. Vitriol may share that our evolved loop stops No can do now is set a break point on this wound application and see what's actually doing. So I've said a break point here and impressed the play button. So it's starting up our application. It's going to fall again. Thanks a little longer because it's the first title application, All right, so if you take a look at our groceries variable, you can see that founded zero because there aren't any items inside it. Idleness. False, of course. And it's just first of 10 2 times on their input, something I'm going to import tariffs and express often. And if you now take a look inside a grocery list, you can see that it going this one. If he opened it up, you can see that on the index off. Zero. There is a string, and it has carrots. Now it's going to rights Council brash by for yes and for no. But the problem is, as you might have noticed, is that we didn't ask if the user want to import something. So we didn't define a consul relying. So if we now press continue, it'll go straight back to a consul right line again. So let's figure that we're just going to set our import. We going to use an oracles or read line? Then let's fire it up again and check. It's working now, too, right away. So let's press the play button again. Or press five is going to stop it or calls. All right, line again on I'm just going to breast Continue. I'm going to feel in a grocery. So I feel feeling carrots and I'm gonna feel into why now, bird, Everything would be actually be fine at this point because we only looking for the end for no. And I'm going to have cake. And if he not looking our groceries this you connects you to see that the countess Still So we have a carrot and a gauge inside. So that's working as expected in the next video, where we're going to take a look at IHS them. It's I've been no. So we want to disclose the application and I wanted to write out our shopping lists and we're going to do that. We have a for loop 25. For-loops: in this video, we're going to talk about the for loop, and the for loop is a loop. It needs to be executed up specific number of times, and it's a little bit more difficult than the other loops. Yes, the Four Loops takes three inputs on in its condition, and the increments in it is a statement that gets executed. The first time that we entered the Ford Condition determines for our longest full ability. Running and increment is after each run is going to increase something, and we can define what is going to increase. So let's take a look at an example. So here we have our sample. It's could see it's still not the same as the value of example you have are in numerous zero. Let me have a for loop and after photo rewrite our number two nickels. Ole. So let's take a look at his father. So the phone upstarts, because in 38 0 and this only lives in the scope of the four low, then it's going to check if our condition is true. So it's e lower than five. Then it's going to ruin our code, which is setting on number variable. If Div alia off the why after Ren Archos inside a QWERTY basis, it's going to increase our e variable if long after that is going to check the condition again. So it's going to check if he is still lesser than five. If that's the case, is going to run a code again, which will set the number two civilian off the why and that is going to increase again. And that's going to check the condition again and so on. And so So what do you think? There's a consul right line is going to write out. Also video are you can just look at the answer, which is four. So why this is for because when he is four and it's set on number with four, it's going to increase with one, and then our condition is false, so it's not going to set our number anymore. So number still for, and it leaves the for loop. So now we get into a more interesting scenario, very going to ride out the groceries inside a list to our console. So we have a for loop. They're in Year zero and e this load and grocery store count and discourages that can't is the same as the amount of items inside a list where you look down. We have two items taken. Care it so he is lowered. And two, Let's take a look at how it's going to work. So ease load and groceries gown, he zero. I said, That's fine. Is going to go to the right line groceries and then block records. E. And this is a way to get a failure from our lists. The zero, which means that it's looking for the grocery at Index zero. And if you take a look at our list of cake, is that index off zero? And this is something really important. Lists always start with the first item at index zero, so it retrieves Are they extreme and goes all right line. It's to our console that is going to keep this place going to check again if her he still load and grocery store count, which is the case because he's full now and it's going to our grocery lists and retreats. The item at index Will Israel be parrots, then it will rights. McGarrett strain to Console Again is going to do Eva's place, then it's going to check if still the condition is true, which is not the case, so it will stop. So now let's implement this for loop inside our coat. So we switched to our editor. The first thing I'm going to dio it's Adam empty calls. All right line, really raw value. And then I go to add another causal right line, which indicates that we have a shopping list. I do this because I want to separate the inputs that we gave with the actually printing off our groceries list. Below that, we're going to start to define our four. So we press enter every topping four open brackets, and the first thing every painting to do, which is a Roman practice, is just to find a in T zero and semicolon to separate our in its 50 condition. Then we say he is lowered or less it and groceries builds guns, and this will give us the amount of items inside of groceries lists. Then I'm going to say he plays plays, too. Increase our value when outgrow, it is done, and I'm going to go on to write line groceries and then open block records, if the e inside it to a console. So it'll riders the grocery at the index cough, the e not of the implements, full up Miss Run application and a steak. A look at what it's doing. So let's type in a grocery. I'm going with big. Then I'm going to press y for yes and a growing feeling carrots. And then I'm going to press end for no. And as you can see it now is at our for Lou. So every press after now we can see that the groceries that the God of two and is going to ride out the grocery, which is that index off zero. So if I press F then now we go to our puzzle, you can see the road out cake. Now if you press a few times after again. So he expose Jake condition now that he s one depressed after now or continued application , and we take a look at our calls Oh, you can see that that sets cake and carrots now it does even a better way to do this on. Let's take a look at that in the next video 26. Foreach-loops: in this video, we're going to talk about the for each loop. It's a little different than the four loop and also a later born easy. So theres a loop that excuse for each item in a list. Here we have a full loop that we just implemented. So you have the four and in it, then the condition and the increments and then Coat Committee before he slew looks a little more easy. Yeah, for each loop on, it does precisely the same as the four above, but you have to do less things to achieve the same results. So how does it work? So the way to read this ISS for each string in our list Groceries execute this goat. So we have here a list strain, groceries and the ways connected ISS that are string Grocery Enough for age is the same as the string in our groceries list. And with each loop when the goat has executed, the Stream grocery will be set with the next item in the list. So let's take a look at an example, because it will be more clear its way. So when we entered the for each loop, the strain grocery will be set bit the first item inside our groceries list. So the first execution will be Don't if the item has the first index, which is zero and bitches geek. So when he calls, all right, line this grocery this well, right out. Okay, The next execution, it will set the stream grocery if the next index which will be Garretts rich on it turn will be written through our console. So let's now I had it back into a code and replace the full of 50. It's more easy for each loop. Now let's implement our for each loop below the for loop so we can see the difference. So we started for each very open of records. We type in this type off our list that they're going to reiterate over so string. And then he gives a key grocery in groceries because that's our list. So we want for each string grocery. Inside are less groceries, off type string. And then we opened up our clearly braces. And then we go and say, goes right, line the grocery and don't get semicolon. Now you can delete the four above its on this just Unicode and see if it's working. So it's going to go, pal. Again on talking about Bow on beacon, typing cake on me. Typing? Yes, they're topping carrots. Every type in end off. No, Miss Cassia rode out the same thing that it did. Three it before Luke. 27. The Grocery class: So now we're able to define the name off our grocery. Let's think about every wounds to put in some more data about a grocery. Let's say we want to put in the amount off how much we're going to buy. We could try that directly into our string. But if you want to use this later on, we would have to puzzle it out of our string by using the sip string or something, which is kind of difficult because we don't know what our users going to enter. So what we want is we want actually the ends off the amount. So I'm talking about going the DIY off the item you're going to buy. The other thing that we can do is defined list. There will keep this up Mt. So we could define a list. Ends groceries. Amount is new list end, and the problem here is that really would need a mechanism which would match the name of our grocery. Were to be amount, because in bond this may be somehow and either Mr Lead ID I was going to keep track off Richard. Mom belong Soup, which grocery? So that's not a good practice I think, because that will be really difficult. The way to fix this is to use classes, which is the basis of whole object oriented programming. So let's take a look at it. So first things first. What is a clause closing billy mechanism for variables methods, which we will talk about in a few moments and more. So what is our priority class going to look like? So we start with a public, then a keyword close. Then the name riches grocery, hoping of curly braces and somewhere close it and everything between these curly braces ISS what's belongs to our claws. So the public is an excess mortar fire, which we're going to talk about in the next video. Damn, you have the close keywords which lets are combined. Know that this is a class and and we have the name of a close. So that's fairly simple. If you don't want to Bendel variables inside this close, we can define it. Besides are fairly braces, so we're going to find a bell extreme name and a publications amount. So how are we able to use this class at this point? So because we're going to use multiple groceries. You have to create objects. Richard Dubai. Instead, she ating. We are able to get to infer from our objects, and we are able to set the info Molnar objects. So first, let's take a look at the Stan Shih ating. So it away we can create an object over a new grocery. Close ISS. By creating room, we create a variable grocery. Richard Jones, Go Grocery, Simon's operator. Use a new key worth, which means that we're going to the extension are close. Then we use the name of our close, open and close brackets and a cynical. So now we instance she ated are objects we are able to get and set data on this close. So the way we can get data is by calling objects type adult, and then we can choose the name variable. So here we have our string name Silent Operator is going to be allocated if the name off our grocery the same we can do for our amount. We're also able to set this data I going Bruce Riedel name and then said it if Garretts and also to say for a mouth. So now we have a small intro into glosses. Let's dive into occurred open official studio and create our first Gerson clause. So up inspectors that are really appreciate his one close per fell just as a broken clause . We now going to Cade our grocery close in a separate foul so we're going to do is right. Click on my groceries list, and then we go to choose, add and add a new item. So it's selected top item, which is class and then below. We change the name from classroom to grocery, and I actually typed is wrong because it should be if why, I'm going to fix that later on in the story. A. Well, so when you've done that, leave extension and press enter. And as you can see, it created a new class fall. So it added so musings at the top. But you can see that they're great out, which means that we aren't using them so he could actually lead these. We have a name space, which is groceries list, and there it created our claws grocery and then opens a very brazen closed it. So the first thing I'm going to do is at public before this close and why I do, Dad, who goes explain in the next video. So for now let's just do dead. And then I'm going to define our variables just like in the presentation. So let's start with the name we start with X. A small fire, which is public then the type off are variable which will be string and then the name operation his name Semi colon. Now you're mountains public in amounts semicolon. And this Actually it's so it's not that difficult. And now we're able to use is inside our program. She s still it is using is because we don't need us on. We want a clean foul and thats head back to up broken CS class and use our freshly created grocery clause. So where are we going to create a new objects decide are well, so what we going to do is instead, she ate a new grocery object and we're going to set our girls Riedel name if this ain't boot. So let's Instead, she ate our checks. You're going to use its up grocery. And if he typed it in, you could see that our editor is helping us. Who we can press. Enter and it feels today. Demi guns in name with Grocery, the Simon operator New grocery and we open and close brackets and, as you can see it stills in something not really interesting and a semi colon. Now I'm going to change this strange input in string input name because we're going to define to influence would name it improved amount. So then I'm going to set our grocery name with the same name. So we use the grocery adult name to set this name variable inside our grocery clause. So let's enter under our April name. So we typing grocery thoughts and then you can see that we have some options. So we have our amount on a few eyes is really a way of our name. But we have also so methods, And the way to see this quickly is that the blue cubes offer variables, and the purple cubes offer methods, so these methods are automatically generated for every clause behind the scenes. And we can actually, uh, varieties, which I'm going to show you in a few videos. So for now, let's just use the name variable and said it with our input name the next thing we're going to do is to write to our console that you also have to type in on amount. So Consul right line devil quotes type in the amount and then cynical. And the next time I go to do is to be able to in boot on amounts. So into input amount of Simon's operator. We're going to assign it with comfort to end and inside it. We're going to put our calls or read line, and I'm not going to try catch it. I'm just going to make sure that I actually feeling a number. So now we're able to set our grocery amount if this input amount. So let's do that grocery built amount and then said it if the input amounts. So along the way that we were doing this, we created some hours. So now let's take a look at he's the first error. Is this input below? Because we don't have a variable which skulled input anymore. So to fix this, we have to create a variable, and we do that by typing string or far before it's whatever you want, and the next thing is described she's don't had and instead of this input, I wonder. Add our groceries. So let's start that in. But that doesn't actually fix our error, but as you might have noticed is that our code is getting harder to read on. To fix that, I'm going to put some enters between our gold lines on. I'm going to separate our Stan Shih ating. The inputs are actually adding to a list. Next, I'm going to fix this hour on the problem. If adding appreciated, this is that we're trying to in food item Rich's off type grocery and we have a list Rich expects a type of string. So it's a fixed that we're going to change the type far less from stream to grow. Three. So let's change that up list and then between the diamond Thanks grocery and also at the end, and you can see now it except are in boot. The last thing that we have to fix now is our for each loop. Because of four h. Liu is still expecting that the grocery is a stream, so let's change that up. Is that strain grocery in groceries beyond grocery, grocery in groceries. So now we fixed all the arrows inside a code. This press the play button and take a look at what we created. So our goal is going to come bow and it's going to open our application, and we have to feel in item type in your grocery. I'm going feeling Garretts. Then I'm going to fill in the amount, which is five on. Then I'm going to press and because I don't want to have anything and press enter and as you can see, it wrote something out, grocery sedates told Grocery. And what road out is the name space off our grocery blows. So what we have to do is giving our own form off for Florida deaths who write out, Let's close up the application. And if you switch to our grocery close, we've been actually see that given the space groceries list and then the type grocery translated to groceries list or grocery because I grossly lives inside our new space groceries list. So in a prone TS. Instead, off this riding out grocery, we can actually write out the name or the amount. So let's pick the name from now on. If I'm right, then we should be back at every started on this type in a name is really Garrett again. Then five men for notes entering anymore. And then you can see it wrote out carrots. But now I'm going to ride out the amount and the name to do that recruit. Use inspiration, so use a dollar sign. Then we open up quotes. Then we hope Grady braces so we can type in something and use grocery build amounts. There he close the curly brace that I'm going to put down a X for the amount in a space. And then I'm going to open up a QWERTY base again and then inside it I'm going to boots are grocery name. So now if you type in the same thing, it should right out five x Garretts. So let's run the application again and be typing Garrett again. Then I'm going to type five then and Ennis Kasey. It rode out five x carrots, so that's really nice. This was small. Enter into classes. Now let's take a look at those exits modifiers, which we talked about 28. Access modifiers: So in this case, I don't have a presentation, so I'm just going to show you by example, because that is much easier. So we're going to take a look at the exit modifiers on our variables, and at this point, it's public, and it's public access. Modify means that you can use the variable as long as you have created object off this glass, and the most common ace modifiers our public and private. So what happens where we said this explode if I to Private? So the private modifier is actually, but it says it's only usable inside to close itself. So if we change now back to public and we take a look in a program CS, you can see that everything is fine. But if you Nalco backs up grocery CS and changed this name at Riboud or variable two private if we don't take a look at our programs, yes, you can see that there is a problem. So if he saved at go back, see a pro CS, you can now see it at their appears. Rats greatly lying below our grocery don't name variable. What it says is that today's inaccessible because over our protection level and the protection level ISS private, which means that we can only use it inside our grocery clothes. And this is also for getting and setting. So began to read data from a variable and began set or writes data to are variable. And if you do the same for our amount, terrible than it's also inaccessible by the problems he s. So in the next video, we're going to take a look at strictures and concerts are a way to set private variables with data. 29. Creating a constructor: in this video, we're going to talk about constructors. So what is a constructor? Constructor is a contract forest Enshi ating an object. And what this means is that we can determine what the minimum requirements are. For instance, she ating our grocery objects. So this is what we created until now. But this is the part that we see. The aunt scenes. There are many more Fes going on. One of these things is that we actually have already are constructor which is the default constructor which is an empty one. And that's this piece of gold right air. And what this default constructor dos iss that we're able to create an object from our clothes without any input or also known as parameters. So what does this look like on we have excess modifier and the name of our concerts which is also the name for close Mind that the name of the constructors always to say just the name off our clothes. But what if he want to create an object with always on name and amounts? We can do that by the final imports between the beck It's off our constructive. So now we have a string name and the ends amount, which we have to give in now when we use our constructor. Well, Houston, she ating So below we see Dad on New grocery now requires to a boots are in good name, and I am put amount in the first Pimp boots, which are input name, will be accessible in our stricter. If the name keywords and our second input input amount, we'll be usable if our amount keyword, historical stricter, then inside a constructor, we can do things we did, like saving it into our attributes, or maybe first manipulated data before we save it. So we always note that when we instance, she ate a whole checks that certain requirements are met. So now let's die backs into a code because I think it will be more clear when we start using our constructor. So Rebecca never adjusted here. We still have hours from the excess modifier video, but first, let's go to a grocery clause. Unless if I are empty constructor so below amount variable or distributes, p person enters, and then we defined public grocery hoping close brackets and opening close curly braces. Now let's go back to the program CS and let's see if something changed. Yes, you see, we sell the same errors with attributes. They don't have any nuance. So now let's go back to a grocery close. And now let's defines from imports. So I'm going to start that string name and then in the mountains and now to see what's happening inside a program CS. And now we can see that there s actually on our and this speakers bend me to find our own constructor. The defense constructive will be over written with errors, say that it can find any constructor corresponding to what we gave him, which is an empty one. So what we have to do next is move our constructor to be lower in booze because we now need those inputs to Stan. She ate her objects. So we move our grocery variable and now we can give in our input name and our input amount into a constructor and expectancy. Now the hour is going between now are able to do is remove these centers because we don't need this anymore because we're going to set off variables inside objects through our constructor. So now let's take a look at what occurred is doing. To do that, we first have to fix these errors. Speakers are excess modifiers are still on privates, if our attributes. So let's go through a grocery close on, removed it private and replaces it public again so that we can run the code. And when you have done that, we can go back to the program CS. You can see that hours are fixed. So now let's place a the burger hole, not constrictor. So we can be Big Walter constructors actually doing and run the program so pressed the play button and it's going to compel. And when compiling is done, then we have to fill in our grocery, which is going to be carrots. I'm going to type in five is the amount on Let's take a look if our inputs are right, so yes, and what we have to do now is breast half 11 which means we go to step into a constrictor on every press. If then again, we can take a look at our inputs. So our first input string name it has to fail you carrots and our second and boots ends. Amount has value five so If you press now, have 10 so more, then we go back to the program CS. There's another time if then. And if you look now at the grocery close and take a look inside, then we see that the amount of Sarah on our name is no. But how is this possible? Well, that's because we filled in the data as the input for a constructor. But we never set the name and amounts variable fifties data. So we have to do that inside our constructor. So if it's live now in our constructor on and then you can see we have two options. We have the name riches to attribute on, which is also with a capital. And then we have the name, which is a smaller and which is the in boot, which has a small, wide books with to block brackets around this icon. So what we want to do is set our attribute, refer in boot. So now we choose our name. If the capital m r distribute them, use assignment operator and reset it. If the name our input on then semicolon so But it will do now is it will set the data over our name input inside our name. Extra good. You can do it Also, dad, for the amount so amounts we have the capital A and then we said it. If the in boot, don't forget semicolon. And if you run the good now again and take a look at it, it should set a date arrived into our objects. So let's failing carrot again using them or five. That's press F 11. An impressive 10 if then, and as you can see now, free press after and again. That name now is actually failed with carrots. If you press f, then again you'll see that our amounts also five. So if you step now outside our grocery claws and take a look at the data, it should be set properly, as you can see here. So five carats and if you run the program now, everything should be working fine again. But now you can create a grocery object. We followed first in putting our name and the amount, so why would you use constructors? Because it's nice to always know that when an object is substantiated, that it's at least has the data that you expected and also If you're working with older programmers, they can misuse your cross that you build. So the next thing we're going to talk about, which is something like a strictures, is actually methods. 30. Methods: So now let's take a loop. Heads, methods and method is simply said, Ah, block off excusable code you can use over and over again in different contexts, so it makes your growth more reusable. So the next thing where I want to take a look at IHS also provide line where it writes out the amount in the name off our grocery objects. So there's something that could be a discretion here. ISS. We should have the knowledge of how to display the data inside our grocery objects. Is that the programs Yes or the grocery clause itself. If we don't define it in Akrotiri close, this means that everyone we uses our grocery clause will define its own way to display the data inside our grocery objects. If you want a uniform the way that we share this combination of dead the amount with the name, you could do that by creating a methods and me with gold is methods. Get grocery info and then empty breakfast because we don't have any input. So what would this look like inside our clothes? So inside a class it would look something like this. You have a public stream death grocery info and returns, actually, the same thing that we normally rode out inside our council right line. So let's take a better look at it, This public. We have seen that before. It's a nexus mortar fire. Then we have the string patients, also known as a return type. After debts, we have to name off our methods. And then inside the brackets behind the name, we can define him boots over methods. If the brackets are anti, we don't have any imports, just like if our default constructor. So we do see many elements that are familiar, but something that's new is a return type, and this return keyword. So what is this return time? It's a type off the data that we're going to return do the color over methods and this return keyword IHS very returned actual data very going to return. So be ivory turn. We expect the string because our return type is a string, which is the case. So now insider for each loop we can call calls a white line grocery. Both gets grocery info with empty brackets because that is going to return this sentence riches the amounts, eggs, space and then the name, which will be the input in to our calls. All right line ritual riding to open ZOLL. So now this is a basic introduction into Memphis. Let's define our first methods. So Rebecca in our visual studio and the press a few answers below are constructor, and here's where we going to find our first methods. So we started our public keywords, so it's accessible outside to close itself, and then you have to define the return. So if you take a look inside a burning tears, the thing that we want to replace his this grocery amount name straight, so to return type is string. So you go back through our grocery clause and you high top public me type string, then retired the name off our methods, which is going to be get grocery info, and then we use empty Beck. It's and then he opened a purity basis and close it down. So do test of this return type is working, less defying our bullion. Israel be bull, and I'm going to name it this and I'm just going to set of it true and semicolon, and then we're going to return to this test on a physical seen now it has a reds quickly lying. This rescue line is because it expected to return a string and not a Boolean. So this is not possible on B aren't able to build a good now, So if he changed it up to strain, then we can set our test string with a 1,000,000,000. We change the test to info, and now we copy this code and we replace our true input into our info with this piece off string. So let's replace that on. Now we get some errors because that's grocery doesn't exist inside a close, and what we can do is to just delete the grocery adults. And then it's working fine. And now we return to info on desk. You see, all hours are going, so that's really nice. So what we can do now is inside a program. CS Meaty uses methods. Let's go back and go through a for H loop at a both for cultural right line. I will define a strain info, and I'm going to set it if our grocery bills gets grocery info methods. And as you can see, our guest grocery info method also hope the inside a selection window. So that's cheers that an opening close brackets cynical. And can we use our A few variable inside our calls? All right, line. Now that's far out the application on Let's take a look at the results. We're going to place our break point on our newly created code on this press to play Bottom four repress play. We can actually deletes all the breakthrough and because we don't need that anymore. And now let's pressed a button. So is going to start a program and that's your notice. Go. Let's take a moment on. Let's just enjoy it that it's actually false because when you have a really big programs is no less fast. So I'm going to type in carrots, and then I'm going to use five, and I'm going to type something else. And then I'm going to use cake and tree, and I'm going to typing and and the second lieut at what our method is doing. If you take a look inside our grocery variable old and we can see it at the data, it's rightfully said. And if he now used to stepping through so 11 or at the left top. We can also use this button it should step into, which also shows that's the F 11. Is the lt serving now steps inside of methods. And if you look, you can see that are attributes are rightfully said And if we now take a look at our info side of program C s, we can see that it's at five eggs Carrot justice we expected. Now I have 10 sometimes and we're back now. And we have now gay care free. And if you press f 11 again, we could step into it so we can check if the data is rights on every press f Then again, then we can see it at our info is also arrived. And now let's just continue to programming and see what's right sowed. So we go to a council on as we expected. It's flat. Fix carrot on tree s cake. So what we can do now, actually is inside our grocery claws began Now change the exits modifier off our experts to private because we don't use this anymore. Outside, I broke three clause. So enough breaks. Yes, there are aren't any references through these attributes, so this change this public to private and now we have shared that that if you work in a team that the oil programs aren't able to use the attributes inside a grocery clause for their own use, so they first have to find a new methods or they have to change the X modifiers, but that's something different. 31. Static and non static: in this video recordings as they collude had aesthetic modifier. And we already have seen this at a program CS in our main methods and with aesthetic modifier. Thus Isett Durmus, the ownership off the fields attributes variable slash methods and this first take a look at steady been a very little method. Instead, it and the only shape off the field or method belongs to a clause itself. And we've actually seen this with the guns. All read line in the council right line. We can go directly on the close itself. The method read line on the method pride line. So what is known Static, then the ownership of field on Method. It longs to an instance of the clause so object and to use these methods and feels we first have to create an object justice we are doing with our grocery clause and as a death weaken golden method on this object. If we not try to uses get grocery info directly on the grocery close, that isn't possible. So that's driving through our code on Let's take a look at this concept, so the first thing we're going to do is actually add aesthetic keywords to our definition over methods. So behind public, you go to type steady. And now we have a few problems because you can only use static fields or valuables or edge boots. Michelle are all the same inside aesthetic context because we changed our methods. Aesthetic context, off arm edit aesthetic. So we know also have to add aesthetic. You are. It's to our name and amount attributes. So that's did add on a steady gig on also at the amount. And when you've done that, we can go to a program CS on. We now actually have an hour and the hour we get ISS because our editor expects that we call the method on the clause itself on not on the instance. So let's try dessert. Let's open up space and now type grocery bills on as you can see, our Death grocery and for pops up. We close the brackets, and that's all fine. But we actually don't want that. It was just as illustration so we can delete this again on we're going back to our non static context. So let's delete this line on Let's go back to a grocery Laws on the lead hold steady keywords on, then we're fine again. So for this video, I want to actually add another functionality to a grocery list. On that is to the lead on item for my grocery list. So we have another option. You can ask we can be done, or we can believe and to create its function as a I'm going to define another methods inside of privacy is so we're going to start a mortar fire, and I'm going to use a booty in Aceh return type, which going to be true if it deleted something and it's going to be false if it was able to delete the thing that I wanted, and I'm going to name the method the lead item from list and to be able to even the lead on items from a list, we have to be able to exercise the list itself. So I'm going to place this in this grocery groceries into our scope off the Bronx, years and north in scope off our main methods, cause otherwise we aren't able to access it. So let's remove our lives from the main method and place inside our class program. So I enter in the opening period. Brace over program, and then I'm going to base it there. And now we actually have some new errors because inside a main effect is now going to say that you and excess unknown aesthetic variable in aesthetic context. So we have to do is at aesthetic keywords to our brochures lists. So before the type B type static and that's going to fix the ever. So now that's all fixed. Let's go back to a delete item from this methods, and let's give it a in boot. So the input every needs to lead an item is the index. So in index is our input because we can say hey, the lead toe with him at this index. So let's implement that. Let's stop in groceries and adults on starve its are for remove on. Then you can see that you have multiple choices, so we have to remove methods, which is going to try to find item that we give in. We have to remove all which going to remove all the items that have a metric If the data don't give in, remove atthe removes at a certain index and move range removes all the items between arrange and recommend using removed at because we have an index and we're going to give it to the index that we get as input inside our methods. And I'm going to just return true for now on now let's implement so that we are able to remove, actually something which is inside our ah Lou on. The first thing I'm going to do is change this instructing Boesel right line, and I'm going to give you more options. So that's going to say Type A for ads Side B for the lead and time. Don't when you're done with adding or the leading items. So now that the instruction is rights, we now have to change the logic. So instead, off input is equal to end. We now have. Input is equal to Deng when we're done, and we're going to add another if statement which going to say, if in poetess Eagle two d for the leading, then we're going to execute this piece of code, which is going to be our lead from this matters. It's when you try to gold is newly created methods. You might have noticed that you aren't able to go it, and that's because we're still working in aesthetic context. On are the need, either, from this method is not aesthetic. So to fix that, we actually have to add to steady keywords to are released from list methods. And if he had a death on, we go back to where we were, we are now able to go. It's so the lead item from list, which expects on input off index on, actually have to create it. Input we have goes over it. Line records input directly into our method. Mystifying variable. PH is going to be called into index and they be able to comfort a causal. We'd line through the end Teoh confer to in 32 then goes, Well read line, Not going to try catch it. I'm just going to expect that I feel in remember, and then I'm going to change that. Go to little. So now we still have to create the loss option, which is Taipei for ask. So we have to define another if it's just going to check if our input is a so what I'm going to do is I'm going to cut this console right line instruction I'm going to place that it all because I want our input to be the first seeing dad we do. And then I'm going to go to the codes, which adds on grocery to our grocery list. And now I'm going to define our if statement be if it's going to check. If you are able to say, and I'm going to base death go decided. So now if you don't feel in something that this a dee or DUM, then it's not going to work. Its gonna is going to do anything, and it's going to ask the same thing again. And the last thing I want to do is add a consul wide line, which lets our using know that it expects an index from the user off which item it has to release. Seven. Now we finished. That's really good on. Let's take a look. We actually created an error. There is no building on best because we forgot a semicolon. So that's why it's really important to always right or semi colons. So this is kind of interesting. We can actually lead on item even if you don't have anything inside a list. So let's do that Let's type the and it's typing a number. And as you can see, we get an argument. Nothing arranged exception. Which means that we're trying to indeed an index that does not exist. So fix this. I'm going to add on a statement to our delete item from this methods, which is going to check if the indexed every Giffin is lower than the grocery scout on off course. You can still type in mind as well on something like that bird, but that's just no made assumption that our users are going to do that. But in a real world scenario, I would check this also. So if the index is lower than groceries ground, we know that the index is inside our groceries. God, if it's posted, if and then we're going to try to delete it and we're going to return true. If that's not the case, we're just going to return falls. So now we can add some new logic. Rich is going to show our user if the leading over item actually went through or not, And to do that, we have to go back to your while. Loop to there are delete item from this is called, and we're going to check if the return off other date, either from this is true or false. So to do that first we have to define on Bull, which going to goal result on. We're going to set it without the leave from this, and then we're going to use and if else statements to ride something to a causal when it's true. So if result, which means that it's going to fight this results true. And what is going to ride out is groceries successfully deleted in our L's, which is going to be written to our friends over and it's false is going to say Grocery wasn't found. So now we actually fully implement this. Let's take a look ahead if it's working so close. All right line Grocery wasn't found on. Let's press it play, but, um, and let's take a look at what is happening. So it's going to build and compel a code and this type in D on type in the index, and it's going to say that the grocery wasn't found, as expected, US. Now let's type in a carats. We're going to give in amounts and I D we go to the Leeds on item at the index off zero and that's true because the first index over list is at zero and in the next video, we're going to take a look at clover rights. 32. Overrides: in this video, we're going to take a look at overwrites. So what are the rights? Every clothes and she shop has a few methods. Recharge generates behind the scenes, and if it take, is don't variable. Henry typing adult. We can actually see this to extreme methods. Riches. One off these methods you also after equals and get died methods. And if you go to below, two out for each loop and we go to our grocery objects on be delete. This gets grocery info methods and piping adults. Then you can see it adds be industry stream method also, but we didn't define its methods. So how is this working well, C Sharp is selling us that every clause should have to strain methods, which is a string representation off that close, and you can implement it yourself or you can just let it default. And because we didn't over I, death is going to be to be fools. So if you run that application on B, add a grocery. So let's do Did this at a grocery and say ever on the sticker. Look at the break point very set on. Let's see what is right side So let's press f then on a stake. A look at what it shows. So as you can see, it shows our groceries list builds grocery. And again, this is the name space adults, then the name of the close. So this is also boats. It shows, man, you don't add that to string. That just adds the groceries to goes all right line. So it's out of Medicaid bills at the extreme methods. So what we can do is over rights to string methods and instead of this, get grocery info uses to string. And the way we can do that is by defining and new methods. And we're going to start with public. And then we go to use the keywords overrides. And when we do Dad, our editor is going to give us a few options, and as you can see, it shows us also three stream and every press enter that is going to show is the default implementation off the extreme methods. So it is a basic string on this basis, something through with higher P off glasses. This glass is actually sip glass off objects, and it's going to go objects to string. If you're interested to check it out, you can right click on it and say, Go to implementation or you can hope for over its and press F 12 and then you can see that we have a public loss with a stream Mefford. So let's go back through our grocery clothes and let's adjust this to stream efforts, and we're going to do is instead off halt our Gretz grocery in photos. I'm going to copy this contact to ask to extreme methods. Now we're actually able to The needs are only creative methods, which is a real bummer off course. And if you run to go now again on, we add a grocery. So let's do Dad. It's typing. Garrett's on best use five on Let's Be don't Legacy is working again. So this very nice. So it's always important to check if something is already there for you to use. And don't try to implement everything yourself. So that was it for over a rise, and now I'm actually going to dedicate a video to fix this spelling error, or which I did with grocery 33. Renaming: So now let's fix that spelling error I made. If the grocery close and instead off i e. You're going to use a Why, of course. And the easiest way to fix that is just rename our close and not close itself but the close foul. And if you do that, it's going to prompt us with Do you want to change this in the world project on I'm going to say Yeah, which is stitch for yes. And as you can see, it's renamed claws and also in a broken CS file. It now spelled Grocery the correct way, but there's also older ways to do it is, and we can do that by going to defend it and we want to change. So I'm going to rename again our bro three clause, and when you click on it and then use the whole ski control are is going to show us something new and and met its maybe promote our I don't really know. You have to maybe look it up good, but it now can do is let me delete it. You can see also are constructor is getting renamed at the same time. And if I changed IQ tests on Now go to a program CS concede at all the references are renamed. Sure, it is really nice, but let's change that back using the same. Come on. So Goto our and typing grocery back again on everything is well now on. The next thing we can do is off course. Just use a text search they have goingto have over a month. He's going to look for grocery. If I e. On, we can change up to grocery. It's why that's the problems here, that it's also going to change that groceries. It's just actually reading to correctly. So be careful with using a text search where you're doing this on. I'm going to leave the rest for now on Skip to the next video, which is actually the lost video off our course. 34. Where to go from here: So with my program tutorials, I always like to gave a video where to go from here. And the first question you might want to ask yourself is, What kind of application do you want to build? And is that a desktop application, maybe an application for your smartwatch, a mobile application or a weapon application? And for each individual device, you might need a difference Guide of coding language and what I mean, if that IHS, for example, the main language for building something with Apple iss swift on you can use. We have to build a desktop application, a smartphone application, a mobile application. But it might not be your first choice when you want to build a Web application, and these aren't the only things you can build something for. You can also build something for hardware. You can build a new bit going minor or something that determines the next failure Off the bed. Going rich might be the best way to you killed him fighting. So let's say that you determined that you want to build a map application. Then there are still so many things to learn and to you, so there are many components where website exists out off on these all used different languages. If you want to build a website itself, you have to use email, C says and JavaScript. But you can also use a frame with for job skip like Anglo Ari exhibition. I actually have a course in in England, and then you have to get access to the data race. You can use a B I for and his A B I Can you build in Java Sea shown that we learned a little today and Biden have. We have also something that we build database engineering that you can use SQL or you can like to look into infrastructure on. As you can see, it's kind of much to build on your own a website on enterprise level. So then you might wonder. Then I use something that already exists, and then you pull into solutions like Fire Base, which is really helpful than your building your website and can help you with things like databases and out staycation out of the book. So what? I think that's really important. Take something that you enjoy building and also loop. If already there is something that can help you along the way. Now the last thing that I wants to do ISS just fill out some basic concepts that might be interesting for you that are in two hearts to look at on your own. Now you have this basis and the first thing ISS interfaces. I also try to authorities in assertive way from easy to difficult. Next inheritance makes a less functions on. You can also look into link database connection so you can set up your own database and connect to it on. Try to use some Cleary's Maybe some out staycation, which already mentioned you can use fire base for some security, which is kind of a broad topic. Deployments. So how you can get your newly made application to your users and develops is something that I really enjoy. Which ISS creating more efficient environments to create your application in and well, that was actually my tutorial on. I actually have that you really enjoyed it and, of course, that you learn something new. Um, if you won't please leave a review, even if it's bad, it's a bad review, Beth. Then I can improve my editorials and maybe the next one you like. And if you're a good experience, please let me know if you have any questions, then please ask in the Coleman section or in the community section. They're also older people can help you, and I hope to see you in no editorial.