C# Basics: Introduction to Programming with C# | Victor Gorinov | Skillshare

C# Basics: Introduction to Programming with C#

Victor Gorinov, Automation QA and Programming Instructor

C# Basics: Introduction to Programming with C#

Victor Gorinov, Automation QA and Programming Instructor

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

    • 2. Install Visual Studio - Your IDE

    • 3. Understand Basic Programming

    • 4. Variables

    • 5. Boolean - True or False

    • 6. Creating Simple Calculator

    • 7. Creating Simple Greeting Program

    • 8. If-else statements

    • 9. Switch statements

    • 10. For Loops

    • 11. While Loops

    • 12. Methods

    • 13. Arrays

  • --
  • 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.





About This Class

Learn C# Fundamentals in 1 Hour and Dive Into the Programming World. C# Programming Basics Explained for Beginners.

Start from Scratch!

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

The course is an Introduction to Programming and It is going to give you an overview of C# Console Application Development.

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

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

  • Conditional Statements

  • Loops

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

  • Arrays

If You Are Someone Who:

  • Want to Learn Programming with C#

  • Want to have Better Career Options

  • Is asking yourself "Is Programming for Me?"

This course is for YOU!

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

Now go ahead and start learning.
I'll see you in the first Lesson!

Meet Your Teacher

Teacher Profile Image

Victor Gorinov

Automation QA and Programming Instructor


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!
  • Yes
  • Somewhat
  • Not really
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.



1. Introduction: Hello and welcome to the introduction to programming with C sharp. Thank you so much for being sure and taking this course. I hope that you're going to get the value that you came here for. You're going to learn a lot of new things, and I hope that you have this mindset off learning because programming is not easy. But I believe that with the step by step tutorials, I'm going to teach you. You're going to do amazing. If you care for any questions throughout the course, please ask me single message. Give me your comments. Your questions. Here in the culinary sections, I'm always improving on my courses, it making them better. So your feedback is really important for me. Also. Please leave a review for the course because it's really important for me. And health helps me reach more people like you. Thank you so much for being here. Now let's start with the first lesson 2. Install Visual Studio - Your IDE: in this video, we're going to install visuals to you, 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, metal 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 myth 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 Ah, 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 console it says here Low World, that was your 1st 1st application. If you've 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 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 pulled 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 world 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 type it 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 mine, 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 he called the five in second number is equal to six and so on and so forth. If you create a round number, this is called Integer in 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, decimal 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 than the double. But I don't want to get you confused. Just remember, 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, 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 the 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 you can. You can use this for any type of variables. For example, are, um, second name is equal to hope groups Peter some, and now the visual studio's 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 non 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. 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 deleting 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 pipe 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 they fold 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 kuenzel 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 our 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. Uh, 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 of 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 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 7. 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. 8. 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 Louth? 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, uh 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? Um, something else I want to show. 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 18. So this is going to be true if it's more than 18 or equal to 18. But now we want to say if ages less than 18 we want toe to write. Sorry, you're not allowed to drink basically your toe 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. 9. 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, the 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 you're 18 your 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 l 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. It's 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. 10. 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 stuff, 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, console right flying to conserve rival in 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 land and you press control and D, you're making a copy of the plan on the next line, that's cool. I'm 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 want to 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 is going toe 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 cream nt 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 11. 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 There 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 12. 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 man 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 now I'm going to show you how this works. So in the body, off the greet user, this metal, we're going to type cons. 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 in future 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 metal 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 two and that if we call here the method 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 code 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 ever 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. 13. 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, where 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 we're seeing 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 the fourth value off the integer is zero. So if we say right now, Gonzalez 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 groups to three for these air, the indexes. And this is the value. This is the value off the the array. So but index number three right now, this is the index number three we chef element with velo zero. And when we say print on the console, the the element with index three, it's going toe print. This this element right here, which is euro. If we say right here loom bursts 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 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 too 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 console? I want to know from you. I will give you a couple of seconds. And, uh, 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, um array off numbers, which is integer. And you you take out some by the index off the ray. You take out the very we can use this, for example, Toe create array, off names interred. You're off. 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 Joshua 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 the third index, which is toe. So if we say here Kunzel right, 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 is 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 in the next lesson.