C# Basics for Beginners: Learn Coding with C# | Victor Gorinov | Skillshare

C# Basics for Beginners: Learn Coding with C#

Victor Gorinov, Automation QA and Programming Instructor

C# Basics for Beginners: Learn Coding with C#

Victor Gorinov, Automation QA and Programming Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
30 Lessons (2h 50m)
    • 1. Introduction

      1:37
    • 2. Install Visual Studio

      3:57
    • 3. Understand Basic Programming

      10:51
    • 4. Variables

      8:13
    • 5. Boolean - True or False

      0:38
    • 6. Variables Homework

      0:52
    • 7. Variables Homework Explained

      2:40
    • 8. Creating Simple Calculator

      7:32
    • 9. Creating Simple Greeting Program

      5:05
    • 10. If else statements

      6:41
    • 11. Switch statements

      3:31
    • 12. Conditional Statements Homework

      0:59
    • 13. Conditional Statements Homework Explained

      5:59
    • 14. For Loops

      5:39
    • 15. While Loops

      5:23
    • 16. Loops Homework

      3:50
    • 17. Loops Homework Explained

      4:49
    • 18. Methods

      9:05
    • 19. Methods Homework

      0:56
    • 20. Methods Homework Explained

      2:50
    • 21. Arrays

      11:46
    • 22. Arrays Homework

      0:43
    • 23. Arrays Homework Explained

      5:12
    • 24. Classes and Access Modifiers

      11:10
    • 25. Inheritance (OOP Basics)

      10:57
    • 26. Enums

      2:30
    • 27. Properties

      19:14
    • 28. Interfaces

      5:39
    • 29. Exception Handling Try Catch Blocks

      5:06
    • 30. Debugging

      6:25
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

176

Students

--

Projects

About This Class

Start Learning C# from Scratch!

Learn C# Fundamentals in 2 Hours, Not Months!

This course is for beginners or people who want to refresh their knowledge in programming with C#.

C# is very intuitive and easy to learn programming language, which can be used for many different purposes, such as:

  • Building Web Applications

  • Game Development

  • Mobile Development (iOS and Android mobile applications)

  • Desktop Applications

  • Windows client applications

  • Windows services

  • Backend services

  • Blockchains and  Cryptocurrency

  • Internet of Things (IoT) devices and much more

In the beginning of your C# learning experience, programming will be hard and that's why you should not try to learn everything at once.
In this course you will learn basic coding skills with C# and all the information you need to transfer to the IT field.
As a complete beginner you need to focus on the Fundamentals and build a solid foundation of your basic programming skills.
In this C# course you will get the best step-by-step training with real life coding examples and exercises.

You don't need anything to start with the course. We will start from absolute zero.
First - We will Install Visual Studio - this is the environment where we write our code.
Next - You will understand the
basics of programming (doesn't matter the programming language).
After that I will teach you Fundamentals that you need to start with, such as:

  • Variables

  • Methods/Functions

  • Classes

Next - We will start writing logic in our code, using:

  • Conditional Statements

  • Loops

  • Inheritance (Basic OOP Principle)

And we will finish with more complex programming, introducing you to:

  • Enums

  • Properties

  • Interfaces

  • Debugging your code and more

If You Are Someone Who:

  • Want to Learn Programming with C#

  • Want to have Better Career Options

  • Want to make More Money at Your Job or as a Freelancer

  • Want to achieve Financial Freedom and Enjoy Life

Get Started Today!

You will also get:
- Support and Answers to All Your Questions During the Course

Now go ahead and accept the challenge.

I'll See You in the First Lesson!

Meet Your Teacher

Teacher Profile Image

Victor Gorinov

Automation QA and Programming Instructor

Teacher

Hello!
My name is Victor Gorinov and I am a Software Automation Engineer and Online Instructor.


On Skillshare I'm teaching IT Courses - mainly focused on Programming for beginners and Quality Assurance both Manual and Automation.


My passion is teaching other people on topics I'm knowledgeable about and seeing their results.
I have always been fascinated by the endless possibilities that we have in our time and the opportunity to reach millions of people with a single click of your mouse.

I am currently working as QA Consultant and in my free time I'm teaching people through digital channels. I am also involved in freelancing, affiliate marketing, investing in the stock market, selling private label products on Amazon and more.

I'm pass... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Introduction: Hi. Welcome to see sharp Basics. Course. My name is Victor Guerrino and I'll be your personal instructor in this course. I'm a software and automation engineer with five years of professional experience and passionately stricter with three courses. By the time recording this and more coming soon in this course, I'm gonna teach you the fundamentals off C Sharp and dotnet step by step. By the end of this course, you will be able to write simple programs in C sharp. I'm gonna teach you everything you need to know in the beginning of your programming experience, and he will be able to work with variables, classes, functions, dates in arms, properties. You will know how to debug your cold and also how to read and understand other people's court. You learned opponent court concepts off C sharp. But the fundamentals off programming which will make it much easier for you to learn other programming languages in the future. My goal with this course is going to show you how to program. But teacher, how to program the right way. This course is made for beginners without any experience with C sharp who want to start from zero and learn C sharp in a clean and systematic way. If you do have any experience with programming, is going to be a plus. But it's not required as long as you're passionate about learning. So if you're ready to learn, see shock, go ahead, click the enroll button and I hope to see you in the course. 2. Install Visual Studio: in this video, we're going to install visuals to do so. Let's go into Google and type visuals to do in the search box press enter and click on the first link. You need to end up. You're on the Microsoft page and you're you'll see visuals to you, I d. E and when you over here on the download button, you see community professional and enterprise version click on the community. This is basically the free version that we need so you can see that it was downloaded installer and click Yes, before we you get started, we need to set up a few things so that you can confuse your installation. OK, continue now. We're waiting for the downloading and installation to complete. Next, you'll see the screen right here, and we need to select exactly what we want to install because visuals to do. If all burnt bunch of options. As you can see, we can install a darknet, the Desktop Development Desktop development with C plus plus I spared dotnet Web development note Js development bite and development or ah, game developed month mobile development of developed development, all kinds of things we're going to need only this one dot net desktop development. So click on that one and click install. Not now. And we have to wait a little bit for the downloading and installation. The complete. Now, now, after the visual studio is downloaded, click on launch. Uh, it will ask you to sign in, but you can skip that step and click. Not now. Maybe later. Here you can choose your color theme. I personally like the dark one. And this is the one I'm using. You can you use also blue Ah, and light one. But I'm going to choose dark here and start visual studio and the here we end up in the actual visuals to you. This is the start Page. Don't get really frustrated from this page. I know that. It looks like a lot of things opened up right here, But don't get confused. You can even close this one. Don't look at it. Click here in the file New end project. Because that's what you want to do. We want to create a new project in our visual studio. So ah, here we can make different projects. Different kind of projects. But we're going to make console applications. So you make sure that you select here visual C sharp and the cause of application dotnet framework. Here you need toe. Put the name off the application. Our application is going to be named my first project. You choose the location off your project Solution name. You can just leave it like that. Type the name of the project Select console application dot net framework and click on OK and you have just created your first project. This is how you create your first project in visual studio. It's called my first project, so let's continue allow with the Lexx. Listen where we're going to discuss what all of these things mean and some basic programming that you need to understand. 3. Understand Basic Programming: Hello and welcome to the next video. Now in the beginning, I want to show you how you can change the color in visuals to do after the installation have already completed. You can change it from here. Tools, options and on the general you will see color theme right here so you can change it to light, for example to see how it looks. Maybe you like it better. This is the light's version you can know. So choose the blue one. Basically, just no see which one you like best. I personally think that the dark one, this is the best one for my eyes. It's protecting my eyes in a way. So now I I'm going to zoom a little bit so you can see the coat and we're going toe. I'm going to explain the things that you see here and we're going to write our first program. So I know this looks really frightening in the beginning, but you don't need toe understand everything in the beginning. Trust me, this is really important to understand right now that in the beginning it's going to be difficult and you will not understand probably anything. But when time goings goes on and, uh, you basically try new things and learn new things and try Try again and again It will start making sense and you'll become better and better every day. So what are these things that are written here? This is the default. Say things that the fault program that IHS starting when we create a new project on we see something called name space right here. The name space is basically container for, ah, classes and metals inside of the program. You don't need to understand that in the beginning. Just ignore it. You may think of it like, uh, something really big. A big container which contains classes inside. This is the class and inside of the class. We have methods. This is our method. Ignore the class ignored the name space. We only need toe right here inside of these metals. This is the starting point of the metal, and this is the end point of the metal. So we're going to click enter here and we're going to write our court here inside of this method. So it's ah meddled with the name main and the main metal. It's basically the beginning off every program. So when you see main, this is your method. And this is where your program starts every time. Every time when you start your program, it starts from here. And it's going to execute this court between these parentheses here. So this is our main metals were going to make a comment here just normally this where you make a comment like this. This is a meth food cold mean, Okay. And we're going toe right, our court here, inside of the main method. Now ignore all of the other things, like strings and all of these arcs and things that are inside of these parentheses. Just follow me right here and right console, which is a class right dot. And now you see what is inside of these class you have here methods which are inside of this class, and you can use them. So we're going to use this metal right here, which is rife line. And if you over, you'll see what this metal does it say's it writes the currents lying Terminator toe, the standard output stream. Basically, you want to write something on the console, so we click on that one and uh, this is how you end your your sentence with with the same economy every time when you want to end your coat. And here, inside of the parentheses, type double quotation marks and type something like mine. My name is in top your name. I'm going to time Victor, and we're going to run this program with control and a five. So press control and a 500 keyboard. And you just created your first program. You will see here on the console. My name is Victor or your name most off the people when they're starting their starting with the program called Shallow World. So you can type here que lo world press control and a five to run the program. And you see on the consulate says, hello, world. That was your 1st 1st application. You have just created you have programmed your first application by yourself. Now again, this console is a class that we're using. We type dot after the name off the class toe, take something from the class and we're taking this metal rife line which, inside of this console class and the in the method, you need toe toe type something inside of the metal basically toe call the metal. And with these double quotation marks, this one and this one we have told this metal that we're going toe give him a strength, a strength. It's a variable type that you're going to learn rate later, but basically it means that you're going to write a sentence. In these quotation marks. You write the sentence, and that is a streak. And we have just called the the right line metal, and we have printed on the console. Hello world. So this is how you write something on the console. Now I'm going to show you how you can read from the console. Or basically, you're asking the user toe type something now again if if we start, the program is going to say hello word because we say it right on the console. Hello world. And if we won't read from the console, we're going to type console dot reid line parenthesis again and semicolon finish. And now, basically, if we run the program, it's it's saying hello world and now it's waiting for us. Type something if we type something now. The program has finished, and with the writing and reading on the console. We can basically ask questions. If we're making a calculator, for example, you're giving ah, first number a second member, and you can get the the some of these these numbers, for example. Now I'm going to show you example not with a calculator. But if we say, hear what thesis? Your favorite favorite number. Now remember, we're writing this on the console because we say rife line. After that, we read something from the console. So basically, we ask the user to type something, and again we arrived line, by the way, I want to show with something something a shortcut. How you can write Consul Rife line If you type c and w in clicked up twice, you're going to write cons or I find this is basically a shortcut. You don't need to tie Peter letter by letter every time. And, uh, we can see here. Wow, that's my favorite number as well. And the king Your guess, What is going to happen right now? Uh, if we start the program first, we see the first thing that we write. We wrote on the console. What is your favorite number and the second line here is a refined. So it's reading something from you. You need to type something. So what is your favorite number? Type 17 and press enter and it says, Wow, that's my favorite number as well. And this is just the simple application that we created. I want to show you how to write and read from the console. This is how we write with the right fine with the relying. You're asking for something to be written on the console. And basically you can create simple applications like that when you're asking something to be given to the console in your typing, something in return. Now I want to show you something else. Maybe you have ah noticed that in the causal class there is something called right, not just right line. And I want to show you the difference between right and rife line. If we delete this relying here and we start the program, you will see that both of these sentences are on the same line because we have said right here and after the right you stay on the same line. This is the difference. After the right, you stay on the same land and after the Rif mind, you're going to the next line. So if we say um, causal rife line here and start the program after this sentence here is finished, we're going to the next line and the this sentence is on the next line. If we say only comes all right, it's finishing the sentence right here, and it's starting with the next one without going on the next time. Now let's continue with the next lesson where we're going to talk about the variables which are really important to understand for a programming. 4. Variables: Hello and welcome to this, lissome, where we're going to talk about variables. And right now, in the being, I want to tell you that if you're completely new to programming, which I believe you are, these things that I'm going to explain are going to be a little bit difficult for you in the beginning. And if you don't understand them right away, don't be frustrated. Just keep in mind and remember that programming is difficult and it takes some time to understand and you get used to it. So with that being said, I'm going toe toe type a variable right now, and I'm going to explain what it is. So what I just did is I created a variable with the name number, and I say number is equal to five. So this variable number have a value off five. And these things int before the number is called data type and the numbers around numbers like 567 10 they are int and int is sure for integer. For example, if we want toe say this is first number is equal to five in second number is equal to six and so on. And so forth if you create ah around number. This is called integer inthe for short discovery. Write it. But it's short for inter in these around numbers. If we want to say Ah that the number is 6.5, for example, it's not going to be correct because this is not This is no longer around number the way we have. Ah, dismal point, and this is making the number double. So we say double third number is equal to 6.5. And now this. Correct. Because the visual stood, you recognize that this is a double. This number is a double and is not making a problem if we say it's equal toe. Uh, no. If we say here that this integer is equal to 6.4, for example, you'll see the red line here that's saying that the number is double and the were using integer here, so it's not correct. So use int for around numbers. We use double for numbers with decimal point. There is something else called Float like that, and it's also used used for the small numbers like double and the only difference is that the double ISS, more precise than the float. When you're using floats, you can put seven characters. I believe seven numbers after the decimal point, and with double you can put 15. So double is a more precise. Only the precision is the difference. There is also something decimal, which is more precise even in the double. But I don't want to get you confused. Just remember on that for dismal numbers, we're going to use double for a round numbers we're going to use in the next variable that I want to show you. That you were going to use very often is strength drink we're using for sentences or when you were writing words for examples. Drink name is equal to John. Okay? And the were were closing here with Sami column and something important when we're writing strings on, you need to put double quotes in the beginning and in the end, off this drink, if we just say John here without the quotes, um, it's going toe. It's goingto make the problem, and you'll see that it's underlined here because when you're using strengths, we need to put quotes in the beginning and in the end of the off the value if we want to have a variable, which is only one character were using char. So char character is equal to, for example, See, And when we're typing characters, Um, it's like a string, but we're using single quotation marks, no double quotation marks. And this is only when you're we have only one character. When then we use char, we're going to create a really interesting program. In a second, we're going to make a cow calculator. But now I want to summarize what we have just learned, and I'm going to ride here as a comment. So in, uh, we're using when we're creating a variable, which is around number double, we're using toe to make this small number when the number is not round. For example, 10.7 drink we're using for sentences or words and char we're using for a single character. Now I'm going to show something else, which is something that I don't recommend using in the beginning when you're creating variables. But I want to show you as an opportunity because if you see it somewhere, you need to know what it is. For example, Far fifth number is equal to 12th and the This is basically the same. Like saying int fifth number is equal to 12. We were using viral when we don't want to, um, toe explicitly say to the visuals to you that this is an integer We want toe the visual studio to recognize this and toe make on integer Yeah, you can You can use this for any type of variables. For example, are, um second name is equal to hope Hoops Peter some. And now the visual studio is going to recognize this. This think is a strength you can say It says here it's a string second name on and we didn't say This is a strength. This is a number. We save our and it recognized the the type off, the off the variable. But don't use this in the beginning. Experienced programmers programmers can use this when they're typing because it's faster and they know What are they? What are they typing? For example, um, the four person types ah var And after that are a or ah, not object or something like they know What are they doing but you In the beginning, they you need toe understand these types, data types and to understand them, you need to use the specific type. So interred your double string and Charlie we're not going to use. But I just wanted to mention it. We're going to use integer, double and strength. And this is what I want you to write in the beginning. Just to to get familiar with them and to know what are you typing? 5. Boolean - True or False: I also want to mention one other type of variables which is bull, which which is short, short for Bullen and is basically true or false. So both true or false is equal to this can be true or false only that so just keep this in mind. We're not going to use bulletins in this course. But just just to know that this is also a variable type boo if you see it somewhere and that the value off this if this variable can be true or false. 6. Variables Homework: Now it's your time to make this exercise with the variables. So this will be your homework. And your job here is to declare these variables with the correct data type or to replace the question mark with the correct data type. So, for example Ah, you delete this this question mark your and you're right. The data type here is going to be integer for Ah, double forest drink. I don't know. You're going to tell me. Just replace the question mark with the correct data type and do this in your visuals to you. Try to do this alone. And in the next lesson, I'm going to show you The explained the explanation off this homework. So try this alone and after yet you're done continue in the next video. 7. Variables Homework Explained: Now I'm going to show you what was your homework. And if you do this correctly so we can just take this, copy these and based it directly into the visuals to your we can do this row by row one by one. But I'm going to just paste this and I'm going to format this real quick. So I'm pressing out on my keyboard right now and I'm dragging down and I'm pressing top three times, so I'm a lightning. All of these. So, uh, I'm gonna tell you. Tell you one more time how to do this. Press out out a lt on your keyboard and with your mosque, you can drag down. That way you can select more than one row, and you can basically for month rose easier like that. So the first number is around number, and that's why this question mark is going to be integer. So we right int first number is equal to one. The second number is a decimal number, so it has a dismal point. So we're going to make it a double. The third number is also around number, so don't get confused because it's a bigger number. It's also around number. So it's going to be integer again. The first name. Let me just correct these here because they're different in the world than the here in the visual studio. Okay. And the the first name. Ah, we already know that names in the words rest drinks. So we're going to replace the question mark with this drink. The last name. Also, it's going to be s drink. After that, we have a single letter. And the I have told you that only one character is declared as a date type cold char or it comes from character. After that, the last one is going to be true. Off or false. And there we have talked about this. This is called a bowline bullion data type. And that was your homework which have just declared all these data types with the correct data types into your double drink char and bullion. I hope that you've done the same. Now let's continue with the next lesson 8. Creating Simple Calculator: Now let's create a simple calculator. I'm and I promise you is going to be really cool. So let's delete this thing right here. And I'm going to leave this these comments for you if you if you want to just look at them into to see what we did previously. So we want to make a calculator first. We want to ask the person who is on the computer to write first number. So we're going to see Consult Rif line five, your first number. And if we were in the program, we can see that this is here on the console type your first number after that, What we want Ihsaa. You want to type number? So we're going to read from the console console dot reads line and the here before the consul Red Line. We want to make this variable, so we're going to say int first number is equal to console refi. Now, I know this is going to be a little bit so for you, but just stay with me now. We have just created a variable first number and we want to read that from the console. But this is underlined because that the Ford Very. When we're reading from the console is strength. It's not an integer. So we need toe toe cast this number this Ah, this drink into a number. So we're going to say instead you're in dot bars. We're going to basically parse what we're really reading from the console, which is a drink, and we're going to make it a number. You know, it's a little bit tough right now, but it's going to be clear, I promise. You understand this better with time. So we created a variable first number and we're saying, read this from the console and this is going to be a number, not a shrink. If we run the program right now, it say's type your first number and we can write something and the program stops right now . This is what way have created so far. Now, let's say console rife line. Actually, let's make this right. No strife line. So this will be the member will be on the same line after the sentence right here. So stop your first number. We're typing our first number. Now we want to say type your sick, um number type your second number and now we were going to make a second variable, which is second number and is going to be again equal toe into integer dot parse. And we're reading from the console. So condo reads line. We're closing here with Sami column. No, what we have just created starting the program. It's asking for a number and you see, it's on the same line because we wrote conserve console dot right, not rife line. So type your first number five type your second number six in the program And this is what we have created so far. We want now toe what we want to do, for example toe to say the first number plus in the second number and we want to give the result in the end. So we're going to say causal that right And we're going to say the some off the two numbers he's and we're going to create 1/3 variable, which is going to be the sum of the two numbers. And we have, ah, a lot of options to make this, But I want to show you how you can, uh, you can basically say the first woman number, please. The sake remember is our are variable and we're going to print are variable on the council Soul integer some off numbers is equal toe first number plus second number and now we're goingto say console dot right and here we're going toe Put our some off the numbers Now what we have created so far, I don't First, it's asking for a number type Your first number were writing the number here After at this asking top. Your second number were writing the second number here. After that, it says some off. The two numbers is and we have created a variable which some off numbers, which is equal to first Number plus in the second number. And we're printing printing the result on the the screen. So if we run the program right now and we see how this is working, type your first number. We're saying we're going to say five. Type your second. Remember, we're going to say 10 and now the sum of the two numbers is 15. But let's make this rife line so it's going toe. Move on the next line and did you look better? So first numbers five second number is 10 and the sum of the two numbers is 15 pretty cool , right, which have just created a simple calculator that is taking the first number of the second number. And it's ah giving us the result. We can also make it like that if you want to, to multiply these numbers. So first number multiply it by a second number on five multiplied by five and the some of the, uh, not the sum we want to be on the here. We want to say the two numbers Muti flights are and five multiplied by five is 25. The two numbers multiplied are 25. Now, I think this is everything you need to know. In the beginning, I know it was a lot, but just stay with me and ah, I promise you is going to be clear and better in the next tutorials and after a couple of days, when you practice is going to be even better and better. So let's continue now with the next lesson 9. Creating Simple Greeting Program: Now let's create a similar thing. But this time we're going to create a program that greets you in this discourse. So we're going to delete all of this, and we're going to start with the asking for first name. So cold, so rife. Flying. Why this your first name? Okay. And we're going to create variable, which is going to be What if we're going toe to ask for a name? Yes. He's going to be us. Drink. So drink. First name is equal to console reef line. And you will see that this time we don't need to parse anything. We don't need the internal parts they were using before, because this time we're we're creating a variable, which is a strength. And this is the default value off the console, so we can just leave it like that. The first name is equal to console, right? Fine. Now we want to take these. What is your second name? And we're going to make a variable. Second name is equal to Causal Reef lime, and we're going to type. Um, welcome. Plus first name plus space, plus second name. I'm going to explain in a second. Um, que loose? No, but it's making like this. Welcome to this amazing C sharp course for beginners. First name, plus second name. Let's see what we did right now. So it's asking us for a first name. What is your first main? The type? Your first name here. Not mine. I'm going to say, Victor, what is your second name? Marine Off is going to say, Welcome to this amazing see shop course for beginners. Victor Green off. Let's make a little bit better. How can now he if, ah, this comma here? So it's looking better and we did the same thing like our calculator. But we did this with strings and we don't need to parse anything because the console redefined is string by default and we're asking for a first name. We're asking for a second name and we're print. Think the fixed right here. Plus the first name, which is it's taken from here, plus the second name. And I put the the's double quotes cure and the space because which free removed that you'll see that it's going to be without the space right here, the first name and the second. Basically, it says, welcome to this amazing see shop course for beginners, and the after that, it's it's taking the first name and exactly after the first name, it's taking the second name before any space. So after the first name, I want to say, uh, give me one space, and after that, give me the second name. And now if we start again, it will be exactly how I wanted to be. Now, I know that was a little bit too much for you, but it's going to be become better and better with time. Trust me with the experience. And, uh, basically, when you're doing the things that I'm doing No, just watching. I'm sure that your you will become better and better and you understand these things. In a couple of days, you will be you'll understand things that, um, first, it was really difficult for you in a couple of days. They will seem much more on this understandable trust me. So just continue with the lessons. And if you want to become a programmer, you will see a lot of things in the beginning that are not making incense and they're difficult. You just need toe, keep learning, and you're you're going to become better with every single day. I believe in you, and I'm sure that you will become a program or so Let's continue with the next lesson. 10. If else statements: hello and welcome to this lesson where we're going to learn if else state months or or you can say also conditional statements, which is really important. And I'm really excited for this. Listen, because this is the first time that we're going toe to write some logic in our program, and I want you to understand this really, really good and it is going to be difficult for you in the bathing beginning, but just keep on learning and keep on practicing, and it will be it will becoming clearer for you. So, um, again, we're going to make a program, a simple application which is asking for your age, and it's going toe its going to decides. Based on your age, we're going to type some logic which is going to decide based on your age. Are you allowed to enter in a bar or not? So, basically is going to decide based on the logic that we're going to type. Are you too young? Are you exactly on the age that you are allowed or are are you hire? Is your age hired in the lot? So we're going to use 18 for for our age this is the the age where you're allowed to get into bars and to drink in Europe. So maybe you're if you're living in the states or, ah, some other country. Maybe this will be a different number for your country, but in Europe, this is 18. So we're going to use that number and again, we're going to write console. All right, flying where we're going toe ask for the for the age of the person. So what is your h? Actually, we're going to use, right, Because we want to write the rage on the same line. Now we're going toe to create a variable. As you already know from the previous lesson, we're going to create a variable here here, which is which is going to be a number. So it's going to be integer, So injure H is equal toe in bars because we we want to parse this into into our consults are comes or really flying. Okay. And now we want to type our large. This is the interesting part. You type if just like you see it right here, put the parentheses here. And after that, the curly brackets and ah, what we're going to do. We're going to type here in these brackets here. Our logic. So if h we can say if age is less than, uh, 18 and we're going to print something here, um So if age is less than 18 I want you to print Sorry, you're not allowed to drink and the here, I want you to understand something else which is important we can we can say equal to we can say less greater on the less or equal toe I'm going to show you right now. I'm not going to just talk so we can say if age is equal to 18 will use the equal sign two times. So if we want toe give a value toe, toe something, we use the equal sign one time and when we use it to times were basically checking for something. If age is equal toe this age with one equal son, you're You're giving a value to something with two equal sense. You're checking if something is equal to something else. Something else I want to show you. We can say if h is less or equal toe 18. Basically, this is going to check. This is this statement is going to be true. Onley. If the age is 18 or less than 18 we can say if he's, uh if it's greater or equal toe 18th. So this is going to be true if it's more than 18 or equal to a team. But now we want to say if ages less than 18 we want toe to write. Sorry, you're not allowed to drink. Basically, you're too too young to drink. Now, after this conditional statement, we want to create another one. So if h less than 18 this is going to happen. And else if age is ah bigger or equal toe 18 then we want toe, right? Mm. Okay, you are allowed to enter. So basically, with this program we're checking. If the age is less than 18 were going to say sorry, you're not allowed to drink. And if the H is equal toe 18 or higher there than 18 is going to say, OK, you're allowed to enter. So let's start the program. It's asking us for the age. What is your age? If I say 17 Sorry, you're not allowed to drink. Actually, let's put one space here. And if we say that our age is 18. Okay, you're allowed to enter. Or if we say something greater than 18 for example to 81 it it will also say, Okay, you're allowed to enter. And based on our logic, this program is checking if we are allowed to enter our not so if some think and else if something else. Basically, this is Qari, right? If else statements just you need to practice a little a little bit. Do this. Really? Ah, a couple of times with different members with greater than equal toe less than something and the you'll get better. Now let's continue with the next lesson where I'm going to show you how you can do the same thing, but with the switch statement. 11. Switch statements: Hello and welcome to this. Listen, where we're going to make the same program that is telling you. Are you allowed to enter the bar or not? But this time we're going to use a switch statement, which is basically the same. Like if else statement, it's your providing a logic which is deciding if he's going to do something else or something else. But it's more elegant. Way toe to right, the logical operator operators from for example. Uhm, I'm going. I'm just going to show you the scene tax off the switch statement. So you're you're right switch. And here we say h after that curly brackets and we have cases. So this is exactly right the if and else so in case. Um, in case this is 18 close. All right, fine. No, we will make this 17 in case you're 17 is going to say you are not allowed toe enter and after the the cons are a fine. We need to break. We need to break out of the case now. The second case is going to be if you're 18 and it's going to say you barely made it, you can enter and, uh we break again and the the next cases, If you're 19 it is going to say Okay. Okay, Grandpa, you can enter and we're going to break again. And we have made exactly the same thing, Like using If else statements were basically saying, If you're 17 is going to write, you are not allowed to enter. If your 18 year bill, you barely made it. But you can enter. And if you're 19 Okay, Grandpa, you can enter. And the we made the same that the same think that we made with the if and else statement. But this time we used switch. So we say, Ah, switch after that would put the name of the variable here that we're using in the cases are the if and else statements. So if we start the program now, it's asking for our age. And if we say seven thing is going to say, you're not allowed to enter. If we say we're 18 you barely made it. You can enter. And if we say that we're 19 is going to say, Okay, Grandpa, you can enter. So I hope you you understand what we did right here. If not just exercise Mom with the switch case statements are righted the right this five or six times with different examples. And I'm sure you you understand how it works. You just need to write it yourself. Now let's let's continue with the next lesson. 12. Conditional Statements Homework: hello and welcome to the homework for the conditional statesman statements or if else statements. Now your task is going to be to write a program that asks the user for three numbers, then calculates the some off the train numbers. And based on that, you're going to create a logic that if the sum is bigger than 100 Ah, you're going to write on the console. The number is bigger than 100. If the sum is lower than 100 you're going to write on the console. The number is lower than 100. And if the number is exactly 100 you're going to write on the court. The council, the number is exactly 100. Do this. The if is if else conditional statements. And in the next video, I'm going to show you how you do this. But first you try this alone 13. Conditional Statements Homework Explained: Okay, Now we're going to make the homework for the conditional statements. And what we have to do right now is to write a program that asks the user for three numbers , then calculates the some of the tree numbers. We're going to do this first. So what we have to do now is we need toe create. Ah, three variables for the numbers that were going toe. Ask the user to write. So interred your first number Paris brief line. Because we're going to read this from the console. Okay. And then I'm going to just press control and deep two times and I'm going to change. Change the names off the variables through second number and third number. This is ah, a faster way to cope and paste. So we have now three variables first number, second member and third number. And we're reading these from the council. So the user types these numbers now. What we here to do he's we need to create a variable. Did contains the some of these from these three numbers. So integer some off numbers is equal to first number. Plus second number plus third number. So we created the first the second and the third number did the user types in the console. And now we have a variable, some off numbers that is equal to the first number, plus the second number, plus the third number. So some off numbers east the the first, the second and third number, something together. So now we need to create our logic. And what we have to do is we need to make sure that if the number with some off the numbers , it's a beer than 100 we're going to write on the console. The number is bigger than 100. And how we do this, we do it with the If, ace, if else statements. And we say if some off numbers is bigger than 100 then right on the console, the number is bigger than 100. I'm going to copy this and paste it right here. Ailes if, um, some off numbers, it's less than 100. Then we're going toe right. Just put once based here to make this prettier. If it's lower than 100 we're going to write. The number is lower than 100. I'm going to cope with this based right here. Ah, and it's made this prettier. And the ills, it's. If the some off numbers is equal to 100 then we're going to write. The number is exactly 100. The number is exactly 100. And what will happen now if we run the program? We need to write three numbers 5 10 and 20. The number is lower than 100 because five plus 10 this 15 plus twenties, 35 slower than 100. Let's make this a little bit pretty. You're right. We're going to right here, please. And 33 numbers. And if we start the program now, please enter three numbers and we write the 25 60 and 89. The number is bigger than 100. And if we right? Ah, for example, 50 25 25. The number is exactly 100. So that was your homework? I hope you did it the same. Now it's Now let's recap everything. Riel. Quick. Just make sure that you understand everything. First we write on the console. Police enter three numbers because we want to start the program with this. So it looks prettier. You know what do the years there knows that he needs to enter three numbers. After that. The we have created four variables in the 1st 1 is our first number that the user enters the second. Remember that the user enters in third number. The user enters. After that we have a variable, some off numbers that is equal to first number plus second number plus third number. And after that we have created our logic. If the some of the three numbers is less than 100 is bigger. Sorry, then 100 is going to write. The number is bigger than 100. If the some of the three numbers is less than 100 it is going to write in the numbers is Lord in 100. And if the number is equal to 100 that's how we say equal with two equal science, then is going to write on the console. The number is exactly 100. I hope that you did it the this exercise the same like me, and I hope that you understand everything. Now let's continue with the next lesson 14. For Loops: hello and welcome to this lissome. And before we start here, I want to say that you're amazing and I know that programming is tough, but you're awesome for continuing with this course. And I thank you so much for being here and not we're going to talk about loops. So a loop basically is a way that it's a smart operation allowing you to loop through something. For example, if you want toe, print the numbers through from one toe, 10 on the console, you can do it, of course. Bite writing konczal rifle and one and, uh, konczal right flying to considerable rise on 345 And the groups, uh, we can do it by that line by line. If you're wondering how I'm doing this, copy and paste without marking the line. If you're here on this line and you press control and D, you're making a copy of the plan on the next line that's going doing it. So I wanted to show you that we can print the numbers from one to thing like that, of course, in the console. But you must be asking yourself There should be a better way, right? Ah, smarter way to to print these numbers. This is not really a smart way. If you want to print the numbers from 1 to 1000 does that mean you're going to write this 1000 times? No, of course not. Now I'm going to show you how you can do this. With a four loop, we're going to write the sin taxes. The following So four parentis is we're going to create a variable here in I is equal to one I t's place or equal to 10 I plus plus. Now I'm going to explain what I just did this actually surely want toe to say console, right? Fine. I now what I just did is I have created the four loop in the I have said that I want the loop to start from one toe finish until it reaches then so less or equal to 10. And I won't print the the variable I which I have said here that is equal to one. So this loop is going toe Come the first time here is gonna print I, which is one After that, it's going toe increment one. This is what this part here is doing so. First year. Initializing the number here. This is the start point off the group. This is the end point off the group, so it starts from one. It's going toe end in 10 and this is the increment operator. So basically, we don't want this I to stay the same every time. When when the loops the loop, it's working. So we want the first time. To be one after that is going to increment. The second time it's going to be to the is going to increment. It's going to become three. It's going to increment and until it reaches 10 and then after that is going to stop. Now let me show you if you run this and it's printing the numbers from 1 to 10 basically what is doing? It's coming. Sure it's checking. How much is I? It's one. It's printing I and it's it's Clemente with one I plus Plus it's incriminating with one. It's basically the same. Like saying here, Um, I plus equal to one. It's is the same thing is going toe ecri increment I with one. So it's going toe. So as I was saying, it's ah, the first time is goingto be one is going to increment. After that, it's going to become, too is going to print. It's going toe increment is going to become three is going to print increment and do it richest 10. So if we want toe print from 1 to 100 use, you can see it's printing from want 100. But now the numbers on 101 and really common way off using loops in programming programming is starting from zero because in programming he always start from zero. You'll see this later on in the lessons for a race. If you're using a ray or a list where you need toe, get some value by index, you always start from zero. This I basically means index. So the index here zero and it will end on 100. It starts from zero until 100. Okay, this is how you use for loops on and inside of the body off the loop right here inside of these two parentis is you can you can make conditional statements you can use. If else you can make some more logic into the four loop, you can basically play with it. And that's how you create a simple for loop 15. While Loops: Hello and welcome to this. Listen, where we're going to talk about while loops. And basically I want to show you the same thing that we did in the previous lesson where I want to bring the numbers from 0 to 100. But this time I'm going to use a while loop. So Ah, the syntax is like these wild. And here I'm going toe put my condition So let me first create Ah variable here because in the four loop we had variables in the loop but in the wild Hope we don't have it. So I'm going to say integer I is equal to zero. So we want to start from zero. And I'm going to say while I is less or equal to 100 I'm good. Oops, I'm going to print I. And if we start this program, you feel that this is infinitive infinite loop. And you never want to do this because in sprinting zero basically without ending and this is going to crash your program. You don't want to do this in the wild loop after the you say Ah, What kind of operation you want to do here? You want to increase the value because otherwise this I hear it's always going to be zero. So I'm saying Print I and after that I plus plus which means increase I with one. And now what is going to happen? I will have the numbers from 0 to 100 basically the same what we did with the for loop in the previous lesson. But now we're doing it with a wild hope. We're giving these variable I avail off zero and were saying While I is less or equal to 1/100 I want you to print I and then increase I with one. So the first time it's going to come the program is going to come here into the loop is going toe ask How much is I? Zero. The first time is zero. Now it's going to print. Zero is going toe increment with one. Now I is one and now is going to get out of the loop. Come here again and going toe. Ask how much is I this time? I this one. It's less then 100 that it's coming into the loop is going to print one After that is going to increment. Is going to become, too. It's coming here again and it's asking, How much is I? It's, too. It's less than 100. Then it's comic into the body of the loop. It's printing. It's incremental. It's coming here again. Checking, printing, incremental. Coming here again, Checking, printing, incriminating until it comes here. And this what? This number Here I is bigger than 100 then it will get out off the loop. So this is what we did here with a while Loop. Now there is another kind of group which is called Do while Loop, and it's not used very often, But I want to show you how it looks like and if we want to do the same thing, But we do while we're going to write, do and click topped up. You don't if you don't remember, sometimes the syntax off something, for example, for loop, for example, if you want to write a for loop, but you don't remember all the things inside of the four loop, you remember the name of the variable, the I plus plus and all of that. So you just right for a laptop in the bad the body off Lupin. Everything that you need is going to be created out magical. But I suggest that you first write it later by later to understand how it works in tow. After you can make it by hand, then you can use these shortcuts. So I'm going to create a dual loop. I just typed Duke and click up twice. So here we want to say what we want to do. So we will have a variable again. I is equal to zero. So do Zo, Right? Fine. I while I is less or equal to 100 we want to increment, I hear basically this is the same thing that we did with the four and with the while loop. But we're doing with with do while we're saying do this think right here. Eso print on the console I the increment while I is less than or equal to 100. So these air do and do while loops. I hope you find it useful. Now it let's continue with the next lesson 16. Loops Homework: Hello and welcome to your loops homework. And I have prepared three easy exercises for you that you need to make, um, regarding toe exercise the loops. And the 1st 1 is using a for loop. You have to create a program that will print on the console the numbers from 1 to 1000. And I hope that you can make this already the exercise number two is using a for loop write a program that will print on the causal only the even numbers from 1 to 1000. And in order to do this, I need to explain something to you. How do you check if a number is even or ought? So there is Ah, sign in the in the programming, which is a mathematical sign just like plus and my inter minus and equal, there is the sign, Cold Percentage sign and what this does with the numbers. It's dividing them in giving you the remainder off the two numbers. For example, if we say to percentage sign, too, Uh, this is going to check if this number ah divided by this number is going toe to return zero or something else. If it's the reminder is equal to zero, then this number is even so. We want to check this number. Ah percentage. Sign this number basically, what this is doing, it's giving us the reminder of the two numbers. So if we say here three for example, percentage sign and two it's going to be equal to one because three divided by two, it's there. It has a reminder off one, and it's That means that this number is not even if the reminder is zero, then the number. This number right here is an even number. If ah, we say four, divided by two, he has a reminder of zero, which is the case then This number here is an even number. Let's say this is the X number. This can be any number can be 12 can be the 26 258. Um, if we divide these bite to the reminder is zero because this number is even. That's how you check if the number is even if the number is not even The reminder is going to be different than zero. And that means that this number is not even so. That's what you need to know inland in order to determine if a number is even or it sought . And, ah, the the second exercise. You have to create the loop that is going to print on the council only the even numbers from 1 to 1000. And on the exercise number three, you have to create a four loop. This is going to print on the console on Lee. The growth numbers from 1 to 1000 using the formula in the mathematical operation that it that I just told you try to do this by yourself, and in the next video, I'm going to show you and going to explain how to do these homeworks or try try it first, but by yourself, and move on to the next video after that. 17. Loops Homework Explained: Now I'm going to explain the loops homework, and we're going to jump right into visuals to you and the first exercise that you have to do, IHS using a for loop. We need to create a program that would print on the console the numbers from 1 to 1000 and we're creating right away, off for loop and with the shortcut that I've just told you for topped up and it's creating the for loop for us. And we want this four loop to start from one until 1000 and the we want toe print the I hear. So what is going to happen right now? It's if we start, this program is going to print from one, but not until 1000 is going to print until 999. That because we have to put on equal sign here because you want our number to start from one until it reaches less or equal to 1000. And if we start now, you can see that our loop starts from one and the ends when it reaches 1000. Okay, this is the exercise number one. We have just created loop that prints on the council the numbers from one until 1000. I hope that you understand this. There is nothing confusing about this. Um, so just we're going to continue with the the second exercise, which is using a for loop write a program that will print on the causal Onley the even numbers from 1 to 1000. And I have told you how you can check this, how you can check if the number is equal or not with the percentage sign. And we're going to say if I percentage sign two is equal to zero, then print I. And basically basically what hurting right now is we're seeing from want 1000. I want you to check all these numbers from 1 to 1000 and even number, um, divided by two. His a reminder off zero. Then I want you to print this number. And if the number divided by two is equal to zero, it doesn't have a reminder. Basically, it's an even number, and we're going to print all the even numbers. If we start the program now, you're going to see that only the even numbers are printed. 2468 10 12 14 until 1000. That's how you check give. The number is even, and that's how we print the numbers from 1 to 1000 only the even numbers and the exercise. Number three ISS. Using a for loop, write a program that will print on the console on Lee. The author numbers from 1 to 1000 and it's really easy to do this when we know this mathematical operation and we have to take only one thing. Sure, um, for example, if I percentage sign, too, is different, then zero. So it's not zero print. I so print only the both numbers, and we started the program. You can see it. It's sprinting 13579 11 13 and so on, so forth until it reaches 1000. Only the both numbers. That's a really easy way to check. Phone number is even or not. Basically, we have said print me the numbers from 1 12 1000 If the number is what and how it check if the number is thought. If the number and divided by two is different than zero or we can say is equal to one, this is exactly the same. Then print me the number and it's printing only the growth numbers. Now, I hope you understand this. I hope that you did the same. And, ah, if not tried to do these two or three more times until you understand how this works and then continue with the next lesson. 18. Methods: Hello and welcome to this. Listen where we're going to talk about methods. And maybe you have heard somebody talking about functions. It's the same, like omitted is just another name off a metal. So functions meant medals her the same things. Now we have seen only one metal so far in our program, and it's the main metal, and this is the metal from where your program always starts. So we have bean typing only inside of these brackets here, which is the body off the main metal. But now, if we want to create another method, we're going to go out outside of these brackets and we're going toe type here. So type with me. We're going toe to use the same syntax like here. We're not going toe, make it complicated. So just type static void. Now the name off the mated. For example, if you if we want to write omitted for which is greeting the user wear writing, greet user brackets, curly brackets and now this is the body off the metal. As you can see, we have a mated here and we have a method here. Our program is always going to start from here from this main method, it's going toe execute the court here in this main mated. And after that going toe toe, go into these metal. But mm. The beautiful thing is that inside of these main metal, we can call our other metals and how I'm going to show you how this works. So in the body, off the greet user, this metal we're going to type comes all right. Fine. And, uh, hello, user. And here, right now, in the body of the main method, we can call the greet user Mitt. So great user. After that, the brackets and the same column. And now if we start the program, it's going to say hello, user, because it went here into the body of the main method and we called this metal right here. Great user. And what is this metal drink? It's executing this court right here comes over. I find Hello, user. So, basically, we're printing this coat when we're invoking this medal right here. Now, if you're wondering, can we put something here inside of these brackets off a method? The answer is yes. This is the place where we put arguments and how I'm going to show you we're going to create another method and we're going toe. Put some arguments to this metal. For example. If you want toe make metal, which is multiplying two numbers, we want to make static, void multiply. And the here you want to put arguments which are going to be the two members so integer. First number on and after that, into your second number and we want toe toe. Here's to say what this method is going to do. So Consul right for line First Number Mort Applied's by second number. We're going to print that on the console and here in the main method, we're going to call the Multiply NATO, so multiply. And here we need toe pass some perimeters to these myths for it, for example, number three and after. After that. Number five. And what is going to do is going toe call this method you're going to check his body, what is dismantled doing. It's getting two numbers, first number and second number, and it's multiplying then, and it's printing them on the council and here we're saying the two members are three and five and this method is going to multiply the two numbers. So if we start the program we see the result is 15. If we say here six and then we're going to see 60 the metal is multiplying. The two numbers we can make the same with adding the numbers very void at and we're going toe number one. See Number one. Number two in here were saying number one plus number two. And here we're calling the at Metal and we're saying that we want toe toe ad number 10 and number 20. What is going to happen here on the second row will have 30 because this is 10 plus 20. It's giving us 30. This is how you can put some arguments in the metal. And when you're calling the metal toe toe to say with what kind of data you want to work with Now I want to explain to you what this word void means, and it can be a little bit difficult for in the beginning. But just bear with me. I will do my best to make this simple. It's possible all its clean, a little bit. I want to leave this metal at and to work with it only so this void is the return type off the method Right now this method is returning Nothing void means it doesn't return anything And we can make this method return some data type, for example integer. And if we change these voids toe int We're basically saying this method is going is going to return on integer and the we have to into your numbers here and we have to say here into the body of the metal What exactly is going toe to return to be returned from the middle So the keyword return After that, we say basically want to add the two numbers So we're saying number one plus number two and this is what this metal iss returning is returning integer And this integer is number one plus number toe and that if we call here the metal at and we were just type two numbers we will not see anything on the screen because we're not printing that. Anything you remember before we had here into the into the body of the method comes. All right, fine. We have to make it the we have to put this admitted here into the console, right line right here. So at and sure we we type the two numbers that we want toe at until we get the summer off. And now we're going to get the summer off this number and this number which are 10 and five . If we start the program, we will see 15. And now this middle has a returned type off int integer, which are two numbers number one, place number two and the we have added here number stent in five and we have printed them on the console. And this type off writing is making our coat much more flexible. And we can we can put some other parameters here. We can return different types and in one of our methods, we can call other methods. And basically, this is how you write your methods with return type. Sometimes you you will want to return to drink a metal. It's going to return strings, but it's working that the same way. If you understand this, that the metal he have a return type, he can be void, which is returning nothing or it can be integer or strength. Basically, this is all that you need to understand. For now, in order to continue with discourse into to use metals like this in the simple way. So I don't want to make this too complicated. The remember Only this, and let's continue with the next lesson. 19. Methods Homework: Hello and welcome to methods. Homework. I have one task for you right now. You have to create a method with a return type, avoid and name divide, which is going to print two numbers and ah, which is going to print two numbers divided in its body. So in the body off the method you have toe print the two numbers divided after that in your main mated, you have to use the divide method with the two numbers. So basically, the method that you have created divide you're going to use in your main method. And you were going toe toe put two numbers inside of these metals. So you're going to call the divide mated and you're going to use it. We two numbers now try to do this by yourself. But if you have any struggles, watch the next video where I'm going to show you how to do this 20. Methods Homework Explained: hello and welcome to the medals homework explained where I'm going to explain you how you can do your homework and you hit one task, which is to declare a method with the return type voice and named Divide, which is going to print two numbers divided in its body. So right away we're creating our May took here after our main method, and we say static. Avoid this. The return type, uh, off the method void and name divide. So starting, void divide. And we're going to pass two numbers here because we need to divide the two numbers in first number and in sick from number and which is going to print two numbers divided in its body . So in the body off the method, we say that we want to print the first number divided by the second number, and after that, use your divide metal inside of your main metal. So inside off our main main middle, we say divides and we're going to pass to members here. So 10 and five, for example. And if we start the program now, we have to because then divided by five, it's toe. And just to make this a little bit prettier. I'm going to right here. The the division off the two numbers is. And now if you start the division of the two numbers east to we can change into numbers here. 50 divided by five. He's then or 567 divided. By then, it's going to be 56. That was all that you had to do. We have created our Met divide, which taking two numbers and is dividing them in the body off the method. So we're writing on the console first number, divided, divided, divided by the second number. And here in our main metal, where you were calling our metal divide. And we're passing two numbers to this method and it's basically saying, First number divided by the second number is giving me this number right here 56. I hope that you did this the same and if not, no problem at all. You are practicing cure, going to learn and become better and better. I'm sure of this. Now let's continue with the next lesson 21. Arrays: Hello and welcome to this lesson where we're going to talk about a race. First of all, I want to thank you so much for being here. And I know that a race are pretty difficult to understand in the beginning and a lot of people struggle with them. So I will do my best to keep this listen a simple us possible. We're not going toe dive deep into collections. We're I'm just going to explain the basics off a race, the basic concept and what our A es and how you can create a simple array operations. Nothing really difficult because this is really important to understanding the beginning. This is your your basis, like when you're creating a building. The basic the the basic foundation is really important. And if you understand this correctly in the beginning, it will be easier for you later on. So let's create now our first array and wadis Honore array is a collection that you're basically using a data type toe create array, for example, integer if we want to create a ray off integers, we're saying inthe. After that we are putting this square brackets, which means we're creating array After that, we're giving the array Ah, name. Just like when we were creating a variable. So we'll make a ray numbers is equal to int curry. Breck. Ah, square brackets. And now we were saying, let's say five. This will be, uh, hopes. Ah, this is how you create on a rake off. Integers were saying, Ah, members, which is an array thes brackets means array is equal toe new array which is including five elements in this array. And when you want toe take on element out of the rape, you are reaching this element by its index. Now we need toe put value toe this indexes because right now we have array off five elements, but they're empty, their zero right now, let me draw this for you because I want you to earn this. Understand this. Right now we have this array. This is our our A. We have five elements inside off the IRA, we have created numbers which is rate with five elements. But right now our elements are zero because the default value off the integer is zero. So if we say right now, guns or rif rif line and the worst Bracker brackets. And three, This is the the index off the ray. It's going toe prints zero. Because what we did right now is he wanted to print 0123 you wanted. We wanted to print this element right here. This element and thesis element zero. So that's why we we got zero here in the council. And why Element number three is this element you're wondering. This is the fourth element It looks like, but in programming, we start counting from zero. So this will be the index right here. 01 two hoops to three for these air, the indexes. And this is the value. This is the value off the the Ari. So but index number three right now, this is the index number three. We have element with velo zero. And when we say print on the console, um, that the, uh, element with index three, it's going toe print. This this element right here, which is euro. If we say right here. Number Erste's three, which is the index off the array on the point Number three is equal toe 12th for example. And now we print this. Ah, this index, it's going to say on the console 12 because right now we have given the value off. 12th to this. How do you delete? Here, Let me see. Okay, with, um, that Okay. And we should have given the value off. 12th here on the index number three, this is our array. Right now, we start count counting from zero. This is the index index zero is the first position. Index number one in the second position. Index number three. Number two is the third position and so on and so forth. But now we have value 000 12 0 because we have given only, ah, very to this index. Right, Right here. Three. So we can say numbers zero is equal to five numbers. One is equal to eighth. For example, when we're stew is equal to 15 numbers four is equal to 20. And right now we have our are a full right now. What we have is on the on the index zero, which is our are first index we hit. If Oops, we have a value off five. So right now on index number zero, we have the veil off five. Okay. Index number zero have available off. Five. Index number one have a very off eighth. Kate. Name index number one have a very off eight. The next number two is equal to 15. Okay, index number two is equal to 15. Index number three is equal to 12. Okay. And index number four is equal to 4 to 20. Okay, so if we say now, Consul Rife line numbers four. What is going to be printed on the council? I want to know from you. I will give you a couple of seconds. And the if you said that it's going to be 20. You're correct. Now we're printing this index right here, which is 20. Okay. And basically, this is how this is how your initial initialize array off numbers, which is integer. And you you take out some by the index off the ray. You take out the value. We can use this, for example, toe create array, off names interred. You're are sorry. Drink names is equal to new drink off three names and, uh, names, names, Kurt brackets. Zero is equal to, Let's say, what would be the name Ben names. One is going to be victor and names, too. It's going to be Draw shore. Okay. Now, if we say cause arrive line names, square brackets and to what is going to be printed on the screen. If we delete this, it's going to be printed, Joshua, because Russia is on index number two. This is how you initialize and you take out the value off off Honore. Now I want to show you a faster way to create on a rate. And basically, we're going to create the same a radio to have right here drink names zero to because we need to have ah, different name is equal to and you can start typing the names right here. So been Victor and Joshua. Basically, this right here is the same like this. It's another way off creating a ray, basically your creating the array in your instantly, giving the values the values off. The rate off the index is off. Very so this year will be the first index which is zero. This year will be the second index, which it's one. And this right here will be the third index, which is toe. So if we say here Quenzel Ryan Flynn names 02 and we take the second index if you're going to print Joshua again. So this console rife line here is printing the second index off this array right here, which is this one and the this, uh and this console rife line is printing the second index off this array, which is this one. And we get Joshua times. If we say printing the first index from here and we started a program is going to print Victor because Victor is the first index on this area. We start from zero. And this in the first index. I hope you understand. Understood something. If not, you just need toe practice with terrorists and you'll get better, I'm sure. Now let's continue with the next lesson. 22. Arrays Homework: Hello and welcome to our ace homework. I have prepared to exercises for you here. The 1st 1 is asking you to make an array off 10 numbers by your choice and print out on the causal. The number off index four only this number and the in the second exercise. You need to make an array with the days off the week and print out on the console Monday, Friday and Sunday. So you need to Preet, you need to print these days from the week by their in the in excess. Try to do this by yourself and I'll see you in the next video where I'm going to show you how you can do this. 23. Arrays Homework Explained: Hello and welcome to this video where we're going to do the homework off a race together. And so we're going to start with the first exercise. We have to make a rate off 10 numbers by our choice and print out on the console. The number off index for so leg. Let's take this step by step. First, we have to create array with 10 numbers and the we're going to use integer because we have to create just numbers. It doesn't say what kind of numbers, so we're going to make wrong numbers. So integer are a numbers is equal to new inter off, then numbers, and we're going to see here in numbers in the zero is equal to 10. For example, numbers Index one is equal to 11 and the I'm going to create these right real quick. So we have created a rate off 10 numbers and we have given the in some values. The videos are from 10 to 19 and, um, what we have to do right now is we need to print on the console the number off index for so we see console rife line numbers off index four, and what this is going to print is this number the number off index four, which is 14 in our case. Okay, It's printing 14 just like we expected. Okay, that was the first exercise. And the 2nd 1 is to make on array with days off the week and print out on the console Monday, Friday, and Sunday again by their indexes. So we're going to the elite this year, and we're going to create this time on array off strengths because we have to create on a rate with the days off the week which our strengths so so drink days off the week is equal to, and we're going to start typing the days of the week we were going to create create this array with the faster way. So one day Tuesday, and we have just created our array with the days of the week, and now we have to print them. Actually, we have to print only Friday. What was Ah, we have to print Monday, Friday and Saturday And how we're going to do this by their indexes. So print me days off the week index number zero, because are zero index this Monday. Okay, If we started. It's going to print Monday. After that, we want to print Friday, which is our index number. 01 234 Kate, print me these off the week Index four And after that print me this off the week we have to print someday. Soul 0123456 So print me days off the week on index six and this is going to prayed to print Monday, Friday and Sunday. And just like we have in our exercise bring Monday, Friday and Sunday and the just to explain real quick why it printing these these days? Because we start our we start count our array from index number zero. You know this. We're not starting from one. We're starting from zero. So our first day of the week is Monday, which is indexed number zero, and we're printing days of the week zero. After that, we have one 234 Friday is four, so we say print days of the week number four. After that, you have index number five and index number six, which is Sunday. We say print days of the week index. Six so 404 and six are these that we need. Monday, Friday and Sunday. That was the the race homework. And I hope that you you have done it exactly the same. If not just practice. I'm sure that you will get better, you understand better. And then you will become an amazing programmer. Now let's continue with the next lesson. 24. Classes and Access Modifiers: Hello and welcome to this tutorial where we're going to talk about classes. So I'm going to show you first how we can create a class. As we can see, we have a class already here in our program, which is called Program. And if you want to create another one, you just click here on your project, right? Click at and new class. Now, you you just type of the name of the class and the for this example I'm going to write animal and click ATS or you select class. The extension is dot CS for class and click at and here in the in your project project. You'll see that now you have the class animal. These are 1st 1st class program dot CS and this is our other class animal, by the way, Let just clear these use ings. We need only the system in the are animal class and also in our program class. Now, in the animal class, we're going to type some properties and we're doing that by by variable. So we want to give the A name off the animal, so string name is equal to, and we're going to call it Peter and the H. He's going to be 10 years old now. I won't talk a little bit about something called access Modifiers and access modifiers are basically you saying how you're going to retrieve data from some class or some method, For example, if we make this class public, so we type public in the beginning before the class. That means that this class is we can retrieve. Take the data from this class from other classes if we connect them. If we connect from the classes, we can take the data from that class to the toe. Another class. If we make this class private, it means that the these data can be axed, accessed only inside of this class. And also, static means that this class is associated with the type and not with some other instance off the type. And no, this is pretty difficult to understand now, um, so just remember that we have access modifiers that can be public, that can be private and static. Deezer that the one that we're using, um, most of the most of the time, so public and private garden was that we're going to use most of the time and study cause well, but static is difficult to understand. So just remember that public you can take the information from anywhere. If you can make the classes and private, you can take the information on Lee within the same class. And if we don't include the access modifier here in front of the class name, that means that is goingto be private. This is the default value. So basically it's the same. Like were we saying private class animal is exactly the same, like just class animal. By default, it's private. We can also type access modifiers, two variables, for example. This drink name we can say is going to be private. And if we try to access this name off this class from another class, it's not going to work. And, uh, if this its public, then it it can be accessed from another class. What we can do right now with this animal ihsaa we can create actually specific animal in our program, our class program and the we already have this other class animal. And if we want to create another animal inside of this program, we created just like a variable. So we say animal and we want to make. For example, dog animal dog is equal new animal. And now we have just created a dark. We took this class animal that we have created here. And ah, we have created a dog, which is AnAnd Animal. And if we want right now, the name off the dog Franks, for example. We can say dog dots name. Or we can print that calls or console rife line, doc dot name. And if if we start the program, you will see that the name off the dog is Peter, We can also print the age off the dog, because in this animal class, we also have a judge. So we're going to the other class and we say console rife line, doc dot h and start the program. Let me see. What was this error? Okay, this is not public. That's why we cannot access this information, you see? And, um, if we run this program again, we can see that we have Peter, which is 10 years old. And now, as you can see with the dot, we can access this class and we can't change something. For example, if we want so If we say dog dot name is equal to now, let's think of a name. It's not going to be Peter anymore. It's going to be Natasha, for example, and the if we print the name of her dog. Our dog was on a boy, and it is certainly a woman woman. But that's not a problem. So if you print dog the name now, our doke is going. Actually, we have printed the that too many times. If we delete the name from here, we'll see that our dog. He's 10 years old and it's called Natasha. So here the name off the off the dog in the animal class is Peter. But in the program class, we have said that the dog name is now Natasha in this in this ah line right here is over reading the other one. And now the name off the dog is not Peter anymore. And the if we say Doc, the age is equal to five, for example. And, uh, we print the doc h and really that from here, I think this a little bit better, and we started The program is going to be in the Tasha and five years old. So this is call your access and your change values in the class. So let's delete this thing right now. I want to show something else. If we goto our animal class, we can create methods or function secure in our class. For example, if we say public void and we're going toe print everything that we give in our animal class So you're going to print calls are rife line name, splice name and also we're going to print age plus h ok, And if we goto our other class which is program and now if we try toe toe, invoke this animal class and in this this metal in the animal class, what do you think is going to happen? Actually, I shouldn't delete our dog. Our dog is equal to new animal. And now here we can say dog dot print, which this print is the metal that we have just created here in our animal class. And what what this method is doing its printing the name in the age off the animal. So if we run this program right now, it will say name is Peter and H is 10 now. This is how you create a class and how you create variables and methods inside of the class . I don't want to toe confuse you with any more information. This is all you need in the beginning to understand. Also, it was not a problem to create the this class animal here in this name space. For example, if I take this class anymore from here and put it right here, there is no problem with that is going toe work. If we delete this animal class for sure. Okay, now it's working. Uh, but I wanted to show you how you're going to make it. If you're if you be really become a programmer and you're working for a client, this is how you're going. Toe, make your other class from here at new class. And basically, you have here on your project different classes. Your you will not have everything here on the same one on the same names based like that. So I just wanted to show you that this is going to work as well. But if you want to create another class, do it from here and just have it in on the separate and the separate file here in your project and the This is how you're going toe work. If you continue with programming 25. Inheritance (OOP Basics): Hello and welcome to this video where we're going toe talk about inheritance, which is one of the core principles off object oriented programming. And the inheritance basically means that you're using your coat. It was developed toe toe, mate to make your coat reusable. Not right. The same things again and again. And if you remember in the last listen, I was talking about how you can connect one class to another class and retrieve data from from one class to another. Basically, you're doing that with inheritance. Let me show you this picture right now, which I believe with is going to be useful for you. Uh, I want you to imagine this that this person is are based class. So the the class on the top and the derived class from this person is another class cold stuff. So basically all stuff are persons. That's why this class stuff in here it's this class person. Also, students are people are persons, so student inherits person. But cleaner and teacher are not students. They're not going to inherit this class student. They're going to inherit this stuff class. So the cleaner is staff in the cleaner is also a person. The teacher is staff and the teacher is also person and the student is a person. But the cleaner is not a student. So the cleaner doesn't inherit this class student. It only inherits this stuff, this class stuff. And because of this class stuff in here it's person. So the cleaner is a staff and also a person the same with the teacher. The teacher is a staff and also a person. But the teacher is not a student. This class teacher doesn't inherit the class student. It inherits stuff in it. Here it's person. I hope that makes it clear. But now it's going to be even clear with some coat. Now let's create our class animal once again. So at new class and we're going to write animal kill. It's make it public little of the things we don't eat. Okay, Also, we're going to create another class, which is dog dog, Okay. And we make this public as well and we say that the dog is going toe inherit the class animal. We're doing that, but by two dots. Okay, Now the dog inherits the class animal, so I want you to imagine that this class person right here is the animal. And this class right here is dark so dark in here, it's the person. Okay. And the inside of this class dog, we can say on it. Uh, this dog is going toe bark, so we make a metal called bark, which is going toe right wolf. Okay. In our class animal, we're going to say that the all the animals have named so drink, name and all the animals have age so inthe h so they they all have the these same properties, so all animals have name and half H. Now let's make another class, which is goingto be kids. So class Kip in here, It's class anymore. And, uh, this class kit is going to have ah, a metal called and it's going to print me. Oh, okay. No, this class person is our animal class. This class right here is our dog quest. In this class, right here is the kit class now inside of our animal class, we're going to create a method called Prince, which is going toe print the name off the animal. Okay, It's going to print also h and the That's all we have. Actually, we have the name and the age off the animal. Now that we have all of this information ready to be used, we can start making our coat in our base class here in our main main method s So we have our animal class here which have ah name in the H and that they're printed. We have a dog class which is a derived class off the animal. So the door class inherits anymore and also has a metal bark. And also we have a cat class which is in which inherits the animal class and have a metal meal. So now that we have full of this information, we can start using it. And now you're you're going to see the power off the inheritance. Now here are based class, which is animal. We have our dog and Arquette. So in our main mated, now we're going toe. Instance, our dog. So we're going to create our dog basically So dog creeks is equal. New dog. Now we have just created our dog and now we want to give a name to the dog. So, Rex, that name is equal to Rix. Okay, Now we have toe to make this public so we can use it. The name and the age of the animal. Okay, so the name of the dog, this Rex and the Rex, the H He's going to be five years old. Okay, Now, if we were in this program, nothing will happens because we have just created our dog. But we're doing nothing. Ah, were we have not invoked this method. And basically, basically, we have our dog, which is called Rex. What, right now is his five years old. But if we want to put that on the console, we we need toe to write it on the console. And basically, what we need to do is we need toe invoke this method here, this print metal in the animal class so we can see the name in the age off Rex. So we say, Rex that print. And if we start the program now, we'll see. The name is Rex and H is five. We can also see here brakes that bark, and he is going to bark. Each name breaks H five wolf. Okay, now we were going to create our kids. So, kids, what was going to be the name off our kids. So, Melinda Yes. You called new kid. Okay, Linda, that name is equal to meeting, though in the dark age is equal to three. She's going to be younger than Rex Melinda dot print. And Linda does me out. And if we started the program now, we will have the name in the age off Our dog in the name of the age are off our kit again. These are this is our base class anymore. This is our derived class dog, which is inherit its which is, um, in here. It's the class animal, and this is our derived class kit, which inherits are based class, animal. And in our main method, here we have instance, our dogs and our cats. So basically, we're creating them and we're invoking them from the other classes. This is how you can use inheritance. It's this just a simplified version. It's basically used toe to reuse your coat. Noto type the same things again and again, and it's ah, making your coat much more organized and reusable. You can see here on the right that you have our class animal, our class kids, dog, and it's really, really organized and easy to use. Um, it will be much more difficult if you if you have everything in one class, because when programs and Web applications become beer and bigger and object oriented, programming is much, much more helpful and useful toe toe to right. So because you you have all your coat organized and youth like like you know what is happening where. And for example, if you write everything in one class, it will become something really messy, and you will not be able to track it after a few months, maybe after a few weeks. Even so, object oriented programming and inheritance really helps to organize into reuse your coat. 26. Enums: Hello and welcome to this. Listen where we're going to talk about in terms. Inam is short for enumeration and the what it means. It's a type that we create that consists off a bunch off constants that we associate with the name. Now I'm going to show you how you can use in arms. So we're going in our program class right here and we're going to write in, Um, just like we write any off our variables. And this enema will consist off days off the week. So we'll call it days off the week and we'll put some constants here, which will be Monday to the Wednesday There is the Friday saw 30 and suddenly and basically right now, we can use any of these constants right here. And, uh, as you can see, they start from zero, and they all have a number askew. Remember, in programming, we start counting from zero. And just like with the A race these days of the week, right here they have indexes. So Monday is in the zero. Tuesday is index one. Wednesday is index to and so on and so forth. So right now we can call for example, days off the week dot Friday, as you can see and Friday East number four index number four. And if we want to change it, we can say right here. Friday is equal to nine, for example. And now Friday, a sequel to nine. And this is how we can use in terms instead of creating variables. For example, if you would like to make a direction in them for direction, some coordinates you can just make him in, um, consisting, cough all the things that you need inside of it and you can basically call it. It's an easy way to call it like like that, the name of the numb dot and you have all the constants right here. So I don't want to confuse you anymore with innocence. We will keep it simple. Now let's continue with the next lesson. 27. Properties: Hello and welcome to the next. Listen. Today we're going to talk about properties or also called gators and centers. Properties basically allow us to control how we access and modify our variables. That's a simple way to explain properties or getters and centers, but I think it will be more more clear for you if I just show you. Now let's jump into visuals to you and make sure that you're using the system name space in the beginning. And what they want to show you right now is, ah, class cold date time. So just type date time and that this is a type off variable that we're going to create, so the name is going to be current. Time is equal to date time dot now, so the current time is our name off the variable, which is type date time and we're saying that are variable is equal to daytime. Don't now, and as you can tell from the name, it's ah, this daytime dot Now it's taking the current time, which you have right now on your system, and you can see here, it says in the in the brackets. Curly brackets, it say's only get It means that it only have get property and we cannot change. Ah, the value off this off this variable So we can use it because it has the get property. But we cannot change. We cannot modify. Ah, we cannot modify these variable If it if ah, it has here after the get also set, it means that we can change it. So what can we do with this variable right now? Ah, If we only have the get property, for example, we can print it in our console screen. So council rife line current time and we're starting the program with control and a five. And you can see that it tells me the current time so daytime don't now tells you the current time. Pretty simple, right? So it's only a get property, so we cannot modify this. And, uh, this is really smart And how we can use this in our programs. Basically Ah, lot of the times you don't want toe toe have the access to change things that you don't want to be changed. So you want to restrict the so you don't want to change something or your teammates to change something that don't need to be changed. Enter when you write your coat. Most of the times and other people are going toe to read that coat or are going to extend your coat most of the times and you're going toe. Work with people from maybe from other countries or people are going toe to reading. Change your coat a couple of months or years after you have written the coat. And basically you need those restrictions in orderto to make sure that the court he's going to be simple and it's going to make exactly what it needs to make. You don't want toe to make a variable, which can be changed changed. But it's something, for example, like this current time, the the the daytime talk. Now you don't want toe have the the Axis to change your date time, the current daytime anywhere. Every time that you want to do this, it's not making any any logic. It's not rational, So some things you don't need to change. Now let's imagine that we're going to create our own own game with players, and each player is going to have held and mama and things like that so we're going to create the class player here, and, uh, we're going toe to create a healthful for this player so probably can't injure is healthy. Sequel to 100. Now let's create the new player here in our main metal. So we're going to say, Player John is going to be called Johnny Sequel to New Player. So Arab, our player. John right now here for health off 100. And if we say that you want print Jones Health, for example, will have 1/100 on the console. And of course, we can say Joan Health is equal to 50 for example, and now his. And if we print that, of course, now we can see that first half 100. And now, after we have changed the he's held toe 50 the it became is 50. But let's say now we want to create a metal which is going to damage our player, and we want to create that here in the class player. So for public void damage and the it's going to take integer ah, damage, it's going to be, um, integer. So we put it here and now our health is goingto be minus equal damage. So right now our player Tom, half health off 100. So right now, our player, John. Hey, if health off 100 so if you bring that out, we will see that we have want a vicious 1 100 And if we say john dot damage and we damage Joan with, for example, 14 Booth C and we print, Of course. After that, we'll see that Jones health right now is 60. So we we damaged him with with 40 and he have 60 health left. And that works just perfectly fine. But what will happen it if someone comes? And some of our colleagues, for example, seven months after that, decides that he wants toe make the health of John Up 30 for example? And he says, John, health is equal to 30 now and then we print Of course, after that, Jules health. Now Jones health is 30. But this person doesn't know that we have damaged John before that with 40. And now that's a problem. So now we want toe to restrict John from take from taking damage like that. So changing, changing his health just behind the scenes without using the metal damaged. So what we can do right now is we can create ah, get property which can only be used but cannot be modified. So here in our class player, we're going to create something that looks like two variables. So I'm going to create private into your total health, which is is going to be equal to 100 also public integer current health, which is going We're not going to say that equal to something. We're going toe open, curly brackets and now inside of these curly brackets were going to say, Get property and inside of this get property, we're going to return total health and inside of our damage method, I'm going to say total health minus equals damage. And now we should replace this health with current health. And now, as you can see, it says data, our property, current health cannot be assigned toe another value because its read only moat that that's because we have only given get property to the current health. And if we try to assign a nouvelle tweet, it says it cannot be assigned its read only moat. That's exactly what we want to have. So we're restricting anyone right now. Toe change the current health off our player by simply changing the value we want toe. Always use the damage method like here if we want to change the current health. Ah, of John. So if we could if we create a set property right now off the current health, you'll see that the the visuals to do now is it's not highlighting the current health with with red. So now we can change the current health because it have said property. So basically, getters and staters are a way off off saying, Are you going to be ableto modify some variable or you're going to be able only toe to use this variable without without the access off changing it. So if you only have get property, you can use the variable. You cannot change it. If you have get and set, you can use it and you can change it. Simple as that. Now these value that we have said here off the current health of John is called value. So right here on our set, where we want to say that the current health is going to be equal to value again, this very right here is these very right here. And what we have done right now is absolutely the same. Just like creating public, intend your health and we give it some value. If you create a standard, get and sit, it's the same, just like creating a basic variable integer. But we can do so much more with this. We can now basically decides how exactly we're going. Toe toe access are variable and we can change it in a different ways. For example, if you want to limit our health toe a maximum off 100 minimum off zero, we can do this by using if and else statements in Southeast Insight off our the current health, because it's going to be really weird if you can. If you can make players health both 100 so basically his maximal health should be 100. But if you hear, hear him, he can becomes with health off 250 for example. We don't want toe have this option so we can limit this bag, saying that if his maximum health is equal or more than Life 100 just use 100. If it's less than zero just use zero eso again. You can not damage him more. The for example, if you have 100 you damage him with 300 he's not going to have health off minus 200. He's going to have health of zero. So because this is the minimum health, So I want to show this with coat. So now what? We can do it here in our center instead. Instead of saying current health is equal to value, we can say if value this list or equal to zero, then our total health is going to be zero else. Beef value is greater than or equal to 100. Our total health is going to be equal to 100. Ailes. So what we're doing here? We're saying if our value is less or equal to zero, our total health is zero. If the value is above or equal to 100 total health is equal to 100. In this case, right here else it's covering everything between zero and 100. So from 1 to 99 is what it's going to happen here in the else statement. And here we want to say total health is equal to value. And I know that this might look really confusing to you right now, but I'm going to do my best to explain it. I want to show you now what we can do with this, because this is simply amazing off the flexibility that it gave us. Because right now, in our main method, now if we print the Jones current health, you will see that he has 100. And if we say John, that would say If you say that you want to make John's current health, for example minus 200 so he falls down from a cliff or something and he takes to country damage Now what do you think it's going to happen? Is he going to have a negative value? No. Oops. Let's print Jones current health. And, um, his current health is going to be zero because we have said that if his health is below zero, then we want to take zero is the minimum amount, so we cannot have negative amount right now. And if he falls from a cliff and he dies, his health is going to be zero. It's not going to be a negative value And, uh, if you want, for example, to hell, John. And we say, um, that oops, that Jones current health is going to become 500 for example. And, uh, we print Jones current health. Now, his current health is going to be 100 again because the the maximum is 100 which have said here, if the value is equal or greater than 100 then I want his health to be 100 no more than 100 . And, uh, if we say that, Jones Oops, sorry. If we say that Jones current health is going to be 50 for example, and we print his health now, this 50 right here is between one and 99. So we're getting here in the else statement where we say total health sequel to value. If it's it's between one and 99 it's going to be up a correct value. So now we're printing this 50 as you can see 50. Now, let me explain one more time what we did here in our center, which starts from here and ends right here. We said that our if our value is equal or less than zero, I won't take zero else. If it's greater or equal to 100 we're taking 100 as the value else if or else the value is between zero and 100. We're taking the value that the way we have Bean passed. So if it's less than zero, we're taking zero. If it's more than 100 we're taking 100. If it's between zero and 100 we're taking this very low. Basically, we cannot have a *** develop. We cannot have more than 100. We can have only correct very between one and 100. You can see this in the console right here. Now, I know that getters and sitters are really confusing in the beginning, so I know that you're probably wondering what have I just saw? But trust me is going to become better And, uh, with your get your going toe to become familiar with the syntax familiar with everything that you can do with them. I hope that you can see the power off them off the properties gether since centers and you see that basically, you can do anything you want. You can restrict the value and you can use of ah variable Onley in a way that you want this available to be used. You can restricts someone from music in a wrong way, and they're really powerful. You will become more familiar with them as you advance. But for now you need only this, so let's continue with the next lesson. 28. Interfaces: hello and welcome to this lesson where we're going to talk about interfaces and interfaces basically make the colt simpler and easier to use. And they're really useful. And within their faces, we basically say what is going to be inside of a class and inside off each inside of each classes, we decide what exactly each method is going to do by itself and the right away we're going to create an interface. And, uh ah, usually you start your interface name with I. So, for example, if you want toe make interface item, you say I fight him. We opened the brackets, the curly brackets, and sure, Ah, we create variables here. So data type for examples, drink, uh, name. And you can just close this. You need toe put properties here, so get and set. Now, let's create integer age and all foam will get and sit here. And now, for example, we can create the metals inside of interface. We will make a void because we don't want to return anything. But you can make this double intend your strength or whatever you like to return. We don't want to return anything, so we make it void. And ah, if you want to decide and if you want to sell this item, for example, we will make a metal sale and we're not going to put anything in sight of the metal. So that's a very simple interface. And if you want to use this interface to implement it now, we're going to create a class class sort, for example. And now we're going to create the public think name full of forgiving Get in the said property and the public integer h we get insect property. And, uh, what we want to do now is we want to inherit the interface. So our class sort is going toe inherit the I I Tim. Now we're going to create a metal inside of our class public fort, and we're going to give it a strength name and the name is going to be equal to name, and the H is going to be equal to five years old. So are sort is going to be five years old, and as you can see now, it says right here that our sword does not implement the interface member, so it basically we don't use the sale metal right here. As you can see right here, it says it's not using the interface and the cell omitted. So what we should do right now in orderto toe face? This error is we should clear we should use the the sale method. So basically, we should use the interface that we're going to create a mated here, and we're going to write on the console name plus has being sold. Okay. And now we don't have this error anymore. And if we start the program right now, nothing, nothing will happen. So what we can do right now is we can make, uh, we can use our sort here inside off our main method. So for for the sequel to new sport, and we're going to give it a name off, sort off this truck show, and now we can call the metal inside of the sort so sort um sil. And if we start the program right now, we will see that the sort of destruction has bean sold. And we we have to put one space here in order to make perfect okay, sort of destruction. He has bean salt. So where were using this method cell and which is inside off our interface, and this is the simplest interface that you can create. This is really useful when you're when you start using object, object oriented programming. And when you develop a larger projects, you can the create multiple interfaces and inherit them. In here, the classes and basically you're cold gets much more organized and much more reusable. You will see the power off interfaces when you get more experienced. I don't want to get you confused with any more details, so keep this in mind about interfaces. Now let's continue with the next lesson. 29. Exception Handling Try Catch Blocks: Hello and welcome to this lesson where we're going to talk about what are the try catch blocks and how you can use them and how you can handle exceptions. First, I want to show the syntax off the try catch blocks. So we're going to type, try and press topped up. This is the code snippet. Basically, we're typing the entire construction really fast. Um, so this is how the try catch blokes looks like. And the water? What are they useful for? You can basically execute some some court. And if on exception occurs, you can handle this exception in a way that you want toe. So you're basically typing some cold here in the try block, and if there is an error here inside of this try, you're catching this error and you're executing some other court here in the in the kitsch metal. I'm going to show you this widow really example. So you get what this means. For example, if we say here in our try, we're going to create too two numbers so intent your first number is equal to zero and into your second number is going Toby equal to um 15 divided by first number, for example, and what will happen here? We're going toe cave on error exception error because we're trying to divide the number by zero and this is going toe toe occur toe dividing by zero exception. What we can do right now is we can type some other cold here in our catch method which is going toe handle this exception. So if we start right here, if we start the program right now, you'll see the that we have. Unhand Aled Exception system does divide by zero exception attempted to divide by zero. And when you start, it looks really ugly. And, uh, basically it's not re pleasant and you need to read everything that you have here on the console. So what we can do right now is in the catch method we're going toe, create our exception. So it's going Toby called exception. So exception. And this is our name off the exception and the here we're going to say that we want print on the console and are plus exception. We're taking this object right here, exception and we can use some properties from these objects, so exception dot message, for example, and If we start the program right now, you'll see that it say's really pleasant and simple for the eye to read that our error is this. So error attempted to divide to divide by zero. Basically, try catch blocks are really useful when you're you are handling on exception you're trying something here in the try block. And if there is an exception, you catch it here in the in the catch block. So you try some kind off cold here, and if there is an error, you catch it here in this method catch. So what we did right here this week. We created the first number, and after that we created the second number that is divided by zero. And this is on error. This is an error that says divided by by zero is not possible. And, uh, we have catched this exception right here. And we have said print me the error message off this exception. And when we start, we see pretty clear that the error is attempted to divide by zero. They're all kinds off. Exceptions in C sharp and in programming in general. And try cage blocks are really useful when you want to try some cold. And if it doesn't work, you try something else in the catch Ah, Cage book. So it's pretty pretty useful to use. Just practice this and you'll see with time that it's really, really useful to heavy dinner in your arsenal. You try something in the try block, and if there is an error, you catch it here in this line off coat right here. So I hope you understand this. If not, give yourself some time and you will get this. I'm sure. Now let's continue with the next lesson. 30. Debugging: Hello and welcome to this lesson where I'm going to show you how you can debug your coat, which is really important. And the in the beginning probably is going to be really strange for you. And you're not going to understand fried away how you can do it. But trust me, with practice, you will get better and better. And the what I've have created right here is on a rape. Ah, array of strengths. And we have the days of the week in our great and we have initialized our hurry. Ah, and we have said that is going to have seven elements in the array. But if we start our program right, right now, you will see the terrorism exception there is on error because we want to party to heart and we have put Friday twice. You have already seen this good job you hear from the sharp eye. But this is not what the programme expects. And the this is our error. So the program expects seven elements. And right now we have eight in our array because we have Friday twice and how we can debug this program and how we can find the exception. This we first you have to put a break point in our coat and we put the break point where we want the the program toe to stop to stop looking for something so Indian off our coat. We'll put this bring break point point and we do it by clicking here on the left side, off the rose. So you click here and you will see this red dot and basically it will start from the first line check the second, the third, the fourth. And it will stop here on this land line. Where is the brake point? And if we start the program right now, now we're in debugging moat and you'll see that it doesn't say that you have a never because the program stops where the break point is. So the program stops on this role rose 17 and the if we want to continue after this role, we need toe press F 11 and if repressed, if 11 now we will see what is the error. So we shave index out or French exception in this waas outside off the bonds off the ari and there is exactly what is our error? We have our array, which have on boundaries off seven elements. And right now we have eight elements. So this element right here, the Sunday element is our eighth element, which is more than hour array can handle. So we have a limit off seven, seven days, and right now we have eight. So this is outside of the bounds off the array. And this is how you d book your coat. You start. Did you stop debugging from here? And the you can remove the break point by just clicking again here. So again, you you press here on the left side, off the coat toe. Put your break point and your program will stop here on the break point, you can put several break points. There is no problem. So the first time the program will stop here on this line the second time, it will stop here. And the third time we stop here because we have three break points Now, maybe this is the It doesn't seems really useful for you, but trust me when you have ah, a bigger project with hundreds or thousands off lines off coat. It's really important and really useful debug your program because very often you have a roast that you you don't know where they coming from. And by debugging, you can simply see what is the error. What exactly is the problem and how you can fix it. So you start the program and the you can check. Ah, right now what is inside of this array? By clicking on the name and clicking on the arrow here. And you see, it's really simple to see where the error is by debugging. You see that? Now we have for these elements until six until Saturday. And this element right here is outside off our boundaries so you can see exactly what it's inside off Ray on object. So you just you will see the power of the booking when you start using it. But this is I'm showing you how you can simply debug your simple programs right now, if you have an error, just put a break point on the the line where you think the error is. So the program will stop here. And, uh, if you want to step over this line, press if 11 and you'll see the arrow ever you stop the bugging from here and you remove the break point by clicking again on the left side. You can have multiple break points, and it's really useful. And you're going to use this a lot when you're typing more court complex programs. So if we remove right now, this line, uh, we have only one Friday. So index 01 234 desist. Maybe 56 And, uh, now, we don't have on error anymore, because our array have seven elements and everything is like it should be. I hope you understand this and the I'm sure that you will understand it even better after you try to de built the book. You're called a couple of times and the you'll see the power of this later when you start typing bigger and more complex programs.