C# Studies | Basic C# Programming with Visual Studio 2019 | Matthew Dewey | Skillshare

C# Studies | Basic C# Programming with Visual Studio 2019

Matthew Dewey, Writer, Writing Tutor

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

      2:30
    • 2. Download and installation

      3:11
    • 3. The IDE tour and Hello World

      11:37
    • 4. String and Char Variables

      6:44
    • 5. Number Variables and Math Functions

      5:45
    • 6. Real Number Variable Types

      4:01
    • 7. Variable and Data Converting

      9:10
    • 8. If Statements and Operators

      7:16
    • 9. Nested If Statements and Additional Operators

      6:00
    • 10. The While Loop

      5:32
    • 11. The For Loop

      3:22
    • 12. Receiving User Input

      4:38
    • 13. Project Discussion

      2:14
    • 14. Project Answer

      8:17
    • 15. Conclusion

      1:20
42 students are watching this class

About This Class

Welcome to my Basic course on C# Programming with Visual Studio!

My name is Matthew Dewey. I am an experienced programmer, having received several accommodations on programming in my formal education as well as tough several programming languages to thousands of students. My goal is to provide you, the budding programmer, the the knowledge you need on programming in an easy and fun manner. In this course I do just that and with one of the most useful IDEs coupled with the C# programming language. C# being one of the most elite programming languages in the programming world.

C#, a wonderfully simple programming language that has encouraged many programmers to pursue careers involving C# over any other language. Of course, it goes without saying that C# is an excellent language, but do you know what is required of you to start programming C#?

As with any programming language it is important you understand the fundamentals and that is exactly what I teach you in this course.

I help you:

  • Install your IDE

  • Establish fundamental code

  • Create and use variables

  • Retrieve user input

  • Process simple data

  • Create basic programs

  • Create simple, useful programs

  • as well as BONUS methods and code!

What about Visual Studio? A popular, widely used IDE that many large applications have been created in over the years. Do you know how to use it to its full potential? Well, in this course we will go through several lessons that will help you get comfortable with the IDE as well as more adept at program creation.

Go no further if you're looking for the course that will guide you into the world of programming! With my course I can guarantee that the knowledge you learn will help you get a head-start in C# programming. I hope you enjoy the course and it helps you on your way into the world of programming!

"Programming is a form of art. It is logical creativity!"

Transcripts

1. Introduction: Hello and welcome to your basic C Sharp programming goes with visual studio. First, allow me to introduce myself. My name is Matthew doing. My studies of programming first began in high school when I learned Java and Pathan quickly becoming the top RT student and then moved on to tertiary education, where are studied RT and further programming languages such as C Shop and see how then became a programming tutor. Having tutored many of my peers in school are then began to teach programming on loan, and a year after this, I became a course professor teaching what I know about programming, and it's languages in this course will be learning about See Shop, a popular and widely known programming language more commonly used nowadays in making video games. However, the bunk use of C shop is to make applications and software and to learn. See Shop in this course will be using visual studio. Visual studio is by far one of the best bodies that have ever used for programming, and I found it an excellent choice. If you're a beginner wanting to learn programming and see shop is the way you're going for beginners. C sharp programmer Visual studio's excellent I d to begin with and want to become fully comfortable of using this. Artie, you're no doubt sore in C sharp programming in this big intercourse will be learning the fundamentals from your first line of code through variables to user input. You'll be learning the cool foundation that you need to know with C Sharp programming Finally in the north with the fund project for you to practice with, my hope is to present his lick tress, allowing you to learn in a fun and easy manner. Of course, it goes without saying that practicing in between lessons will help you if you begin to struggle. But I can guarantee you, by the end of this course, you will have the fundamentals down and will be ready to take on your advanced studies in C Sharp programming. Thank you for taking Michael's and enjoy In the next video, I'll be showing you a way to find and install visual studio 2. Download and installation: I know and welcome to your basic C sharp course with visual studio. And in this video, I'm going to show you where you can download and how to install. Visual studio. Community Visual studio comes in many versions. You get the standard, the professional and the community. The community is the three rd and the one that we'll be using in this course to Donna it. You need to go to the visual studio website, so go to your preferred Rossa. In my case, I have Google Chrome here. Go in, search Google and Top in Visual Studio. Click on the first option visual studio dot com. Go to visual studio I d. Over here and click download for Windows and we're gonna be using community. It will then down the individual studio community that e X e installation file miners on one desktop read. Jules will no doubt appear in your Downloads folder or your Documents folder. Once you have located the Ekezie, you will then run it. You can then look at the terms and agreements. Bet by clicking continue. You agree to them and move on to the next phase of installation that will then install visual studio, which open as follows as you can see it is loading the products that they have available, and the part will be selecting is, of course, that I d visual community. You will then be presented with the following options, but you're then do is select the following net desktop development. Once you have selected knit desktop development and then click install. Once the installation is complete, you will then need to create an account of Microsoft a love account and log in with that. Once you have done that, you can start the program visual studio and begin programming. Before this video ends, I'm gonna be showing you a way to customize the look off the body. So that way is much more visually appealing. Having a stock what background when programming is a big floor, which is why it's important that you adjusted. So that way it suits your ours to do so. You go to tools. Options go to Environment General, and then you'll see color theme at the very top of visual experience are selected dark, making it much easier to look at when programming you're then click OK and the sittings will be applied in the dark version set up and there we have it. That's concludes this lesson. In the next video, we'll be creating a project and writing our first line of code. 3. The IDE tour and Hello World: Hello and welcome to your basic see shop course with visual studio. And in this video, I'm gonna give you a quick tour off the visual studio I d. E as always, Creative First Project and Roger first line of code. First, let's take a look at the Solutions Explorer here. But the solutions Explorer here does is help manage your projects being the properties, the reference, the configurations, etcetera. So when we create a project, we will find that it appears here in the Solution Explorer, giving us various options to edit the project at the top of the I. D. E. We have the essentials for any I D program. The bar beneath this contains various shortcut buttons, for example, creating a new project or new class saving and running your program, However, throughout this course will be simply be using keyboard shortcuts that will save, open or run the program at a push of a button. Now let's try crazy in a project to create a project, we go to file new project now. There are many things that you can see here. Now let's discuss what we see over here in the sidebar we have what we have installed and what we've been stored is visual C shop and sad. This folder. We have different frameworks. We have the dot net standard. We have test. We have the Windows Classic desktop, which is what we will be using. We have other languages, are the project tops and they're on land services. However, we won't be using any of these for now of creating a project. We won't be using anything except Windows Classic desktop and council application. So when creating our project will select Windows Classic Desktop Council application and we'll give our project a name, we will be cooling our project. Hello world. We will be calling a project. Hello, world. This is most common name for any beginner program because we run our first traditional piece of code. Hello, world What you will see soon enough. You then Concil ect where you store your projects as you can see a story mining my user folder. This is the default and it is easy to locate. However, you can have a specific folder in your documents. So it's more easily found that once you have all those sit, we can then click OK and create your program and I don't be intimidated by what you see, There have been some changes. As you noticed. For example, we now have a property selector on our executable file. Hello World, which, as I said before, has now appeared in Solution Explorer. And now look in our main program's code to you. What you see is a lot of foreign code. However, they are some familiarities. For example, we have class program so that we know that this is the program. Also, we have this in the title above. Next we have the name Space Hello, world What you recognize as your project name. So this is the program for your project. More specifically, it is the main program for your project. Meaning when you run your program, the main code is executed here. More specifically in between these set of brackets below static void Main main giving you a clue as to why this is the main program. You'll be writing your code in between here at the top of the program. You see these lands here again? Don't worry too much about it. These are defaults. Sit inside the program. So when you run code it cause upon certain machine Kurds stored within the I. D. These are the lands occurred that court. However, we won't be using most of the machine code that it is really imported into our class. This is because this is only a basic course, even in an advance program you won't be using quarter of the code, the import. So don't worry too much about thes imported files over here. What you need to be focusing on next. It's writing a first line of code in your main program, returning to our Solutions Explorer. It has the following files that I told you about before Properties riff reference configuration. Of course, the program itself properties containing the Assembly in for this is usually the non execute herbal code that stores the information on who were and how the program was created , such as the name of the program, the Description configuration copyright trademark, depending on what the program is. So if we double click, you'll see it or hear what you have are several lines of code again, a lot of it quite foreign team. You have these assembly lines which contain the values and information on your program, such as the title description configuration, etcetera. And you have these green lines of code that start off with these forward slashes. These Ford slashes represent comments, meaning that this isn't even code. This is just information written for the program is benefit and not necessary, meaning I could remove all these lines off. The Ford Slash is, our program won't run any different. Returning to our program and now, looking at references, your notice that there are several files system system call Marcus Soft See shop. The default off this body is to expect what we're gonna be using in our program. And how does this is reference Different code with within its framework to your specific everything from Microsoft C Shop to system xml dot link contains the Kurd that we might or might not use again. It is a broad expectation of what our program will contain. For example, system and system called contained the core code that will be using. Obviously, we won't be writing all of it and system Dr will contain the code will be using for daughter basis, which we won't be doing in this course. But as you can see, it is imported a lot of code for us to reference when we write it. Then we have the app dot config file which contains all of the configuration. Kurt, for this application, fairly self explanatory as it concede. Use this version 4.0, it has the dot net framework version and so on upon startup, it runs this framework the framework that we using now. So really, it is the startup code for this application itself. And finally you have your main program program. When I double click it, it opens up the file again. So of course, if I close it and I run it again, it appears. And finally, we have our main program, which is brought yet program dot CS. So, looking at our three lands here again, we have our name, space Hello world, meaning our project. We have our class program which, as you can see here, is the sea shop cross over here and inside our program class, we have the static void main, which will contain all of the curd, will be writing, as you can see above the the primitive glasses that is calling here all grade out because we aren't using any code from them. However, this is where we were at our first line of code and you'll notice there'll be a change. Our first line of code is what is known as the Hello world output. When beginning any language, you learn your first line of curd, which outputs a simple line of text otherwise known as a string to our port. It we have to call the consul, seeing as this is a consul program and the council's where output appear. Which up in the consul, referring to the class, you notice that the first name space system has been highlighted because we're officially called it. Now that we've done that, we put don't. And now we have a selection of methods that we can use with the consul. What we want to do without consuls output something. In other words, we want to write something inside the consul to appear for the user or programmer us to read, to rot. It is as follows consul rot, and what will be using is right on this, meaning that after the hello world has been printed, it'll start of new fresh line. This isn't necessary, but seeing as there's always in successful output curd written by default. We don't want to mess up our had a world line of text. You'll notice this where you run out program. But how do we decide what we want to rot? Well, first, we create a set of brackets and inside double quotations. The brackets contain what various will be printing. There's can be anything from a value to a variable, but in this case will be using a value. All text or string valleys are encapsulated in double quotations. Hence, while we have double quotations inside the output brackets, inside are double quotations. Weaken right output, which is hello world, and you may have noticed there's a little rate era to end of Alan because, like all lines of code, we need to have a semi colon to close. As you can see, Visual Studio has an excellent user interface suggesting Kurd that might be missing, which is Raja below an expected a semi colon so that at it, and you'll notice the era disappears, weaken save, then with control is now to have completed a lot of code. Let's clean up our program since we're not using these lands of curd we can either comment them out or delete. Um, you can hear the selected more and press backspace deleting them. Oh, you compress Alton enter while having your cursor over one of these great lands, and it'll provided with an option to any unnecessary could. So doing this it's much more efficient and saves us time from looking for unnecessary code . And now we ready to run our application to run an application we need to build and run it to do so. We praise control. If, and just like that, a consul opens up and we have our put hello world exclamation mark, and we have press any key to continue. This, of course, when done, closes the council and there you have it, a quick tour off the visual studio i d. How to create your first project and write your first line of code who are cleaning up any unnecessary lands as well. An excellent first listen and a classic result that's concludes this. Listen. In the next video, we'll be looking at text variables 4. String and Char Variables: Hello and welcome. Teal Basic See Shut close with visual studio in this video will be discussing text variables. First, let's create a project which we're gonna be working in Were to file new project. We select Windows Classic there, stop we select council application and we give it a name. Such a text practice, you don't click, OK and we go straight to our skeptic void main method and we begin our cutting. The first thing you must understand about variables is they can come in two forms that will be working with In this course we have the normal form which is just the variable itself, a specific top containing a value. And then we have the constant form, the constant for being a variable that cannot be changed in this video, you know, discussing text variables. So I'll be showing you two different text variables that will be using and how to make them constant. The first variable form will be using is a strength. A string is a lot of text containing usually names, strings on large amounts of data to create a string as as follows string. And now we have created a top. We need a variable name. Let's go available name, and we will give it a name value to home. When it comes to naming variables, it's important to understand certain conventions. For example, favorable names cannot have a number is the first character. If variable names contained multiple words, the first word is usually in lower case and the risk that follow on upper case. But these are the naming conventions for variables. So for other programmers as well as you, it is easy to understand where the variables are and what they're doing. So we've created a basic variable to give it a value we say equals. And since it's a string we contain, it's fairly in double quotations. As we learned in the previous video, so would create a set of double quotations, and we'll put in the name such as John. And as with all lines of code, we close with a semi colonel, and it's like that with created a string variable military grated it. We can use it later without having to initialize it, meaning give our topping in so we can change its value on the same name equals and in double quotations, something like blog's close to the cynical. Now if we were to up with this variable, we had called our council again console, and we had rotted the same way as if we wrote something else. So Rot lan, instead of double quotations, continue no value. We just put it the variable name close to the semicolon. Now let's run a program by pressing control if and you'll notice that Prince of Value blog's and not John, this is because we change the value and now to make our fable constant, said Underwood's, it cannot be changed. We had CEO in his tea space before the very winning, and you'll notice it is now under land, the re initialization of the name in raid. This is because it cannot be done. We have made available name constant. Therefore, we cannot change its family. So if we were to run the program, it would run an era. So removing that line and running the Bergen again it prints John. Now that's just one tick stop. There is another which is used to hold single characters. This top is known as H R. Variable charm, being short toe a character, meaning that it can contain only one character. So let's change our code. Yeah, to suit a character variable. We will move the constant line here, and it's rot char and it's given a name. Name again equals. And instead of double quotations, we would use single quotations denoting that will contain only a single character. This could be anything from a number two letter to a special character, such as a hash tag symbol. And as for lands, you close with the semi colon. If we were to run our program again, it prints hash tag. But being that it is a different variable top, you can still use it hand in hand with strings by printing them in a certain order. For example, let's create another string string word equals and in double quotations, programming close with the cynical. We would then go to our consul rattle on, and we can create a sentence using these variables as well as adding our own. So right now it is printing the name variable, which contains hashtag, but we can add more characters afterwards. For example, if we had plus and we had would, it adds in value word after. So when I run the program again. It prints hashtag programming, but that's not only you can do. Biding double quotations in the output land is well. You can create sentences that print before or after opinion on where you place your double quotations. It'll works on an order based system. So in our door quotations, let's front I m space add another plus symbol. So that's where the program knows We're adding them to each other to form a sentence. We run a program again. I am hashtag program. And as with a string variable, we can also make char variables constant so they cannot be changed. If we were later try to change their value, for example, we make name equal. The value of it shows an era because name cannot be changed. And there you have text variables that concludes this lesson. In the next video, we'll be learning about Inter Juve, Ebel's 5. Number Variables and Math Functions: Hello and welcome to your basics, Ishaq Walls with visual studio. And in this video, we're going to be discussing integer variables. First, let us create a project which will be working with sets file new project. And I'm gonna call my project meth because with these intention, variables will be doing math functions. We go straight to our main miss it, and we begin our cutting. You must know that we work with full, different integer variables. When it comes to FC shop, there is bite their short there is int, and there is long. The bite into value is a variable, which can contain up to 256 values ranging from 0 to 255. So might taste equals to 55. However, if we try to make it equal to 56 you notice that there is an era symbol. There's being out off a bots range. The second top of mentioned was a short interview Top the sort interject top can contain values from negative 32,768 to 32,767. This being negative 3 to 768 or a positive 32 767 No more than this, however, can be contained. The third interview top and the more common one, The INT into J. Top. This contains Van is from negative 2.1 billion to 2.1 billion. Being that this is a ridiculous range, the integer into variable Top is used more commonly than most interview tops. It is recreated as follows and let's go a Test three equals and let's give it a large value . Closed the semicolon and, of course, the final interview top, which is the long interview Tom. So that long and let's call a test for and the range of this interest top is infinite. It contained an infinite amount of values sell. It creates another long integer value close to this in Yukon, and those are for interviewed. Dr Tops Order, Meth Functions, which I mentioned earlier. Well, let's first change the values off all of these four variables. For example, let's change our but 50 let's change our taste to to 100. Let's change our test three 2 3000 and let's change taste form into full. Obviously, these owned the best uses for these valuable tops, but we're just gonna be doing basic math functions to see how they work. Secretary of the numbers. Simple. So the math is easy for us to follow. Now let's create a consul rattle UM council. Not right line. Now the meth functions that we more commonly no addition and subtraction are no different example. Test plus test, too, should be a 150 when we run out program, and it is indeed I have a lot to change. Test to test three and change the addition to subtraction said 3000 minus 100. We run up program, we get 2900 we do indeed. Now our math functions still include division and multiplication division. Being a forward slash is 3000 divine about 100 which is indeed 13. And then we have multiplication, which is the Estrich symbol. But the shift eight. We run a program, we get 300,000 which is correct as well. And of course, there's still the meth order, such as addition before subtraction and meth contained within brackets are done first, just for example, let's taste those out but changing these values, adding a ship brackets around them again. We add in addition afterwards, and then we create another set of records inside this one. We will have test for times taste Now, working on what we have learned from before, this will become 300,000. And if this set of records works out correctly, test four times. Taste is 50 times full, which equals 200 and then we have the addition in between. So when you run the program, we should get 300,000 and 200. So let's run a program and we do indeed, so the meth rule store plan. And we can use that to our advantage by completing advanced meth. So there you have before interview tops, as well as how to use the math functions that concludes this lesson. In the next video, we'll be working with rial number variable tops 6. Real Number Variable Types: hello and welcome to your basic C sharp programming calls with visual studio. And in this video, we're gonna be talking about the rial number variable tops. First, let's create a project file new project, and I'm gonna call my project double daughter once they got your main method and will begin coding, it should be known that there are three different tops of rial number variable tops. There were is float, double and decimal. Both float and decimal contain a ridiculous range and double having an infinite range. The most commonly used rial number variable top, is the double and being that is the most commonly used. Your also need a space a far to the compiler when creating a float or decimal. How a specified to the compiler is by adding a special character after we've. Instead, she ated a value. For example, that's great. A float float numb equals 5.5, a normal decimal value. But to make sure the compiler treats this numbers afloat, we had, if after close with cynical on and don't worry this if one be included when working at the value so far to go to a consul, right land console but right Tom and in South set of brackets num plus five. Closer to see McCollum. If we were to run a program, you notice it's still prints 10.5. And, of course, with the decimal, we have to write in another special character. So let's create a decimal that's goes numb to equals, and it's a 6.1. The special character that we have after a dismal is in close to the same a colonel and there you see, we have no errors with it. However, we will have trouble working with these numbers together, seen as they different tops off variables. For example, we go back to a concert Gatland and change the value far too numb to your notice that there is an era. Although these numbers can work with other inter jizz and even doubles, they won't work with each other. Another workers doubles is this follows? We can create a double. Let's just go. A test equals and let's give it the valley off 10 point one close to the same account. No special characters needed novela to change. Numb to do test, you notice they are no heiress. So when you run a program, we get 15.6, which is correct. 5.5 past 10.1 is 15.6. However, if I were to change, numb to numb to, there would be an era. Sina's decimal cannot work with a double. This is actually very useful. Instead of troublesome, we can create a separate daughter top, which we can work with in the background. So why we have float and double work with the interview temps? We can then use decibel in the background for our own profit calculations, which is very important and programming as we can make constant values and work with them throughout. And there you have the three rial number for table tops that concludes this lesson. In the next video, I'll be showing you how to convert certain daughter tops into other daughter tops. 7. Variable and Data Converting: Hello and welcome to your basic see shop course with visual studio. And in this video, I'm gonna be showing how to convert certain variable tops into different variable tops. First, let's create a project with which we can work in. Go to file new Project Windows Classic desktop Consul application, and I'm going to give it the name conversion practice and click OK, now that we have our program open, let's be encoding. The first conversions will be looking at is from a but to an integer A but can contain a small amount of number. Values on interject can contain a lot more. This was discussed in a previous video. What I'm gonna show you how to do is convert a barn value into an integer value, and it's a simple is placing the value in the in danger. Instead, she ation code. For example, let's create a but the let's give it the value off five close to the same you can on now. If we were to converted to integer such as Inter gender. Um, we just add B. We'll instantly store the valley when you run your program into the num interject. This is because the NUM can contain a small amount. It's larger mouths that will have difficulty and or third era. This is what is known as an implicit top conversion, meaning it is possible to convert this number barely into this one because the value is within range Off this top. However, if we were to create an integer, it was a very off let's say 20 and place it into a. But Gordon, um, you would notice there's an era being that 20 is beyond the capabilities of but which can only hold up to eight butts. This is known as an explicit top conversion, so let's continue looking at implicit top conversions throughout working with these indigent value tops. Let's make integer into afloat, which works out just fine because, as you know of Florida, can contain more Belize in an integer So that's great into numb equals 200. Close the Simic on and we will use float. Taste equals no, a simple conversion. Now, before we look at other variable tops, let's learn about how to cast variables. Returning to our previous statement where we had the Inter Giambi and Barton, um, we could convert a value from Inter Jane to, but as long as it is within range, so let's make sure is in with range. You notice they're still in era. So what we need to do, then to convert the interject to a but is costed Karsten is by simply adding a set of brackets and the top you wanna convert. So this will be, but clothes are set of brackets. And just like that, the program reads, it converts it, and you have now distorted interject into About the same goes for converting afloat to an interview. So if we created a float just equals 5.5. If closer singing come on because, as we know afloat is a double top we can then converted to integer are casting it so int I equals and let's put in the very real name, which is test close to the semi colon. And that's what convert the double tub barely into an interview top. Very, And this will convert the rial number into an integer number and will be displayed as follows. So it's created Consul not right line and and inside a set of brackets will put I close the semi column. Now let's run a program about pressing control a bath, and you notice father's printed instead of the real number value off 5.5. Because we have converted of 5.5 early into an integer and it cannot contain decimal points . So are casting worked correctly, however, this this is a simple form of casting, however, for other variable tops that don't work with each other but still contain values that we need. World Cryer a much more advanced form off casting. So let's leave into I Over here equals test, and we're gonna create a String Bailey court test and give it the value off one. But in double quotations, surgery is stored as a strength, so that will look as follows. A string taste equals double quotations, one close to the same you cut on. You know this is an error because we cannot cause test into an integer. Yet it contains interview value and no string characters. So how do we convert it? Well, there are two ways we can convert it. One is we can call upon the convert class or weaken. Do a simple past method. The convert classes more advanced and sometimes isn't necessary as past is far simpler to use. So let's change the land of year and use the convert class to call the class we tapping convert dot and we use the method to int lady too. And in the set of brackets replace our test valley goes with the same me. Come on. And just like that, we've converted a stream into ninja. So when we run a program again, you notice it prints one. And we know this is a working indigent if we add a value such as one to this run out program again and prints, too a successful conversion. However, the more common way to convert the Valley is to pass it, which is done as follows. We top in the value you want, which is a int dot pass another set of brackets and inside what we want to convert in this case string. So let's run a program again and it works just the same. No classes are called. This does make up program a little bit more efficient, but it's to a nominal extent, so either way works. Now let's talk about converting a chart to a string and of course, there are many other conversions. Besides converting riel numbers to inter jizz, Orent urges to real numbers or strings to real numbers or strings. Advantages weaken us to convert Charles two strings by simply adding the child daily to the end of the string search. Test this out. Let's remove this line over here. It's great. HR that's cool, etc. Equals a single quotation such as t Close the semi colon and we added simply to end off our value in the test line. So plus C now removing the addition of a here and adding in the very, really want to print such a test, we can run our program on a notice. It prints won T. However, we can still convert to do a string purely on its character base alone by simply having the double quotations in the set over here. So let's from the program again and Lola the same can be done with indigenous. If Charles was an inter Jowitt, simply add the interject to the end of the string, thereby converting the value into a string value. And that is how you convert certain variable tops. Two other very book tops as well as convert daughter tops two different daughter that concludes this. Listen, in the next video, we'll be looking at if statements and logical operators 8. If Statements and Operators: Hello and welcome to your basic see shop course with visual studio. In this video, we're gonna learn how to create and use if statements before I begin explaining what if statements are and while we use them, let's create a project in which we can create our code. So we go to file new project when there's classic desktop council application and if practice and click OK now literary greats at our project. Let me discuss what the if statement does. The statement is used to compare pieces of daughter. In other words, we can check and compare values and opinion on what the results would be. We can create specific code that will run depending on the value that comes up. We use operators to compare daughter, for example, greater than equal to or less then as the most common. So if we wanted to check if an inter GIs value was above a certain number, then we can use our operators in an if statement by then creating specific Kurt That'll run if the result is true. So let's drop practicing one of these. If statements first, let's create a variable which contain a value for us to campaign, such as an intern job, good, numb and we give it a value off. And now let's create an if statement that makes use of operators that check to see if numb is above 10 to create the if statement is as follows. If, within open up of a set of brackets and inside, we will have the variable number and the operator will be using Now, since we want to check if numbers greater than 10 way, say, if numb, great to then 10 on our throwing an error, because we need to create a section which would contain the code that we'll be using. What we do to create this section is a sit off curly brackets. Notice it automatically creates another set of brackets. It will close off the section the section Now, whatever code is contained in between the set or run, if none is greater than 10. So, for example, let's create a simple output line has just council right lon on an incentive brackets and I would double quotations and in the city of brackets will have a double quotations encapsulating the word Hello, close with the sea me Colonel. Now as you know our numbers. Fath. Therefore, it is not greater than 10. So if we were to run a program by pressing control your five, you notice a consul appears continue. Nothing to show for the user. This is because we have no code are putting that meets the requirements of the if statement . So let's create one with the if statement code will run. So that's changed the value of numb to 15. We run out program again, and this time the council appears of the word. Hello. So if statement not only checked the daughter, it ran a specific code. If the chick proved true which it did, Numb was indeed greater 19 Of course, to create a bit of program, we can't just have code that runs. If the statement proves true, we need a have could that also runs. If it proves hopes to do this, we create what is known as an if else statement else is used to create another section of code which will run if the statement proves false. So we go back to our if statement and we add and else and then another sit of clearly records. Notice how I Indian theme here. This is the most common way to set out. And if statement now let's create a land of curd which will run council dot right, and let's say we print none in this console. Now, of course, if we run the program now, it will still print hello because the statement proves troop. So let's change it back too far for the value of numb. Run the program again and notice it prints Lindholm value, meaning our statement proved false. And so we had a default set of curd ready to run in the case of that happening. Now let's go through some operators that we will be using throughout you have seen the greater than operator but is also the greater than and equal to. So let's make the greater than or equal to. As such, we have the symbol and the equal symbols, just as it were in mathematics. Now we know if you run the program, it will print the Numb Valley. However, we cannot change. Number 2 10 seen as 10 is now included in the list of values, so if we run a program again, it brings hello and any number above team at also Prince Helen, such as 15. So there we have the greater than and equal to and of course, the less than and equal Toso. Plus, we can have 10 and the program will run perfectly. And we can also have one, and the program will print the same result. So we have the less than the greater than their greater than and equal to the list than and equal to. Now, what about equals? Well, when it comes to programming, we use the double equal symbol to campaign. Seen as a single equals is used to give a very so in this one operator is equals equals. So if numb equals 10. So if we run the program now, it prints and I'm value. But if we print 10 it prints Hannah. So that is equals. And now for our final operator, we have the not equals to the nuts equals two. Operator is represented by exclamation mark and the equal symbol. So if you run the program, it should prove false and print the nun value, which it does indeed, because the num value is equal to 10 I refer to change it to anything else such as far and run the program. It prints level. So if statement proves true in the first line of code runs and they have the if statement that concludes this lesson in the next video we'll go over nested if statements. 9. Nested If Statements and Additional Operators: hello and welcome to your basic seashell because with visual studio and in this video, we're going to be looking at misted if statements and additional operators, as you can see, I'm working on the project we previously created. If practice since we're still working of his statements, let's continue practicing in this project. First, let me discuss what a nested if statement is in ist it. If statement is an if statement within an if statement. Of course, having an if statement of in if statement and completing basic programs seems pretty redundant. For example, if we were to ask the is that if a number is greater than 10 but also less than 20 we would have an if statement checking to see if a variables equal above 10 and would have a second if statement within checking. If this variable is below 20. Grating, such basic daughter is not usually necessary. However, since this is a basic course, we'll be working some basic examples. So let's work on the idea that we're looking for a number in between two values, for example, between 10 and 20 not inclusive of those numbers. So let's create an if statement that works that way. Let's erase this if statement and creates if and working with our variable quit already numb is greater than 10. We didn't create a set of brackets. Now that we've created a if statement, let's create a 2nd 1 Asking variable is below 20 not inclusive. So if none is less than 20 recreate another set of brackets. And now let's have an output to work with, such as consul dot rutland. Hello, Flores with the same economy as of this moment, the variables equal to five. So for you to run this program, it wouldn't get past the first if statement, as you can see when we were on our program. So let's change the Valley to above team such as 30. It still doesn't print out anything because it may get past the first if statement, but it doesn't get past the second, seen as the number is greater than 20. So let's meet the requirements of both these. If statements change in the value to 15 running the program and hello is indeed printed, and that is a very basic if statement, Of course, this nested if statement can be made redundant by using these additional operators, I'll be showing you now. These are known as the end and all operators. So let's copy this lawn over here. You race the if statement within, paste the lawn, and I'm gonna be showing you how to combine both if statements, the end and all operators are used. Chick daughter. Several charms be it the same variable or another variable to create the end and all you need to go to the brackets of your first. If statement, go after your first check and to create an end, you top in double and or if you want to create the all symbols, you would use the vertical land characters two of them as well. And following these double character sits who will have the second operated test such as Numb is less than 20. So if we run out per game now, we notice it works the same way. However, this is an all operator, meaning only one of thes checks need to be fulfilled, so a number greater than team that is simple enough. It's great 50 way run a program and it still runs or a number below 20 again. This is also very simple. We can change to five, run a program again, and it still works. So this if statement is fairly pointless, seen as it still includes every number that an interject can contain. However, if we change it to the and symbols and means both off, these chicks must be proven true before the code within the if statement can be run, meaning the Valley contained within the number integer must be greater than 10 and less than 20. So at the moment we run the program, it doesn't work. If we made it greater than 20 it still does not work. And now, if we were to meet the requirements of Buzz and it's safe of Dean again, run the program, it works. We have now simplified our coat by using another simple operator, saving us invested if statement, which can be very complex and indeed confusing, especially when working of larger programs. Now, as for how many, if statements can be contained within an if statement, this can be done infinitely. You can have an if statement with an if statement within an if statement, and there are continue. We will be here for a while because it is just that infinite. You can have as many if statements within, if statements as you'd luck. And as long as they all work, Artemis and you'll still have a working program. And there you have nested if statements as well as additional operators. 10. The While Loop: hello and welcome to your basic C sharp course with visual studio. And in this video, we're gonna be working with the wild. When it comes to programming, you'll be writing several 1000 lines for many advance programs. And as such, it might be to your benefit to use what is known as a loop to save your Tom and code. They are two loops that I'm gonna be teaching you in this course. The first loop is the wild lip. Do you create a while? It was similar to that of an if statement, while a statement is true inside the brackets, all occurred with in the wild lip will be run until the statement is false. To simply show you, I'll be creating a counter variable and be using it with wild. First, let's create our program and start making our lips were to file new Project Windows cast desktop consul application. I'm gonna go home on while practice Now that we're in our program, let's begin creating a loop first. Let's create an integer which will be used as our counter int num and let's give it the value of zero. And now let's move straight onto the wild to create a while up top in a while and like an if statement, you need a have a close. So while numb, let's say is less than 10. We then create a set of brackets Norge to place our code. The code within these brackets will be looped. For example, let's create a simple art foot land council dot right and in the city break. It's a simple text such as wood closed the semi cone and now so you can see the loop. In effect, let's run up program control if and your notice in the console window that is printing word far more than 10 times. This program that we've created will continue to print word until the claws number less than 10 is made false. Certainly close our council window and adjust the code. This is where account of variable comes in, but we have created is a simple interview. Variable off the value of zero, but to make it a counter, we have to add or decrease its value at a repetitive rate. For example, no equals numb plus one. Every time the loop is now run, numb will have an added one to its value. So if we run out program, you notice it. Prints would 10 times so numbs value has increased by one. Every Tundra loop has been run until the clause numberless and 10 was no longer true so that we can see this. Let's create another output at the end of the program that will tell us the name Israeli consul dot right land and in the set of brackets numb running a program again, it prints 10. Now keep this close in mind. Less than 10 meaning the moment that Numb became 10. It didn't run the lip again. If we were to say less than and equal to 10 the loop would run again, and the new Valley for Numb would be 11. However, let's keep it at around number with the loop runs 10 tons. Now there's a simpler way to increment to the number. Really, instead of saying them equals num plus one, we can go numb plus. Plus, this adds 12 numbers valley each Tom, the code is run. If you run a program, you notice it runs the same way. And there is, of course, a reverse you can top in numb Manus Manus. But as you know, if you run the loop now, it will run infinitely, none, becoming less and never reaching tip so that we can see this change. Let's change the lace, then to Greater Than and a tin to negative 10. We run a program that works the same way except negative. 10 is now printed at the end of the program, said they re habit a simple wild And of course, this doesn't have to work. Uh, vintages closes. Contain any top of values as long as the valley that is returned is either true or false. And there you have the wild that concludes this lesson. In the next video, we'll learn about the four loop. 11. The For Loop: Hello and welcome to your basic see shop course with visual studio. And in this video, we're gonna learn about the full loop. In the previous video, we looked at the wild lip and discussed the fundamentals off loops. We learned that the while loop makes use of a close similar to that of an if statement. If the clause proves truth, the loop runs if the clause proves true. The loop runs once and continues to run until the clause proves false. Keeping the sin Monda PIRG American creates a loop that is designed to work around daughter that can't be predicted. However, when it comes to a four loop, we can make use of the same principle and fully use the counter variable. The for loop is one of the most commonly used loops, and I'll be showing you how to use it in this video. First, let's create our project file. New project. I am gonna calm on for practice. Okay, now the two inside our program. Let's create a for loop straight away. The Fuller makes use of a counter built into its close the Foley Bullock as follows you top in four and a set of brackets. Now the clothes is rather special because they are three parts to it. The first is the creation of a variable and an instance e ation of its value. For example, int I equals zero. Now that we've done that part, we separated from the rest with a semi colonel and create the next line. What comes next is similar to a close. We can say I is less than Tim Analogy have done that close with Simi column, and afterwards we add on to the value of our I plus plus. And just like that, we've created a custom loop that includes its own counter. We then create a set of brackets in which to place our code. For now, let's just use a simple are put council dot right blanc and Devil quotations. Output closes the semi Conan. Now, as we have done that, let's run our program control if our and there you have it output printed 10 times and there you have a full it run similar to that of a while. It, however a while loop can make use off several different clauses. But when it comes to more basic code that we just want to run several times. None is better than that Off the for loop that concludes this lesson. In the next video, we'll learn how to get user input. 12. Receiving User Input: Hello and welcome to your basic seashell course with visual studio. And in this video, we're going to learn how to get user input. Let us first create a program to work with file New project. I'm gonna Coleman User input Practice. Click OK now Receiving using input is very similar to that of the Consul Rockland Code, except when it comes to use the input. It might be better to store your values inside a variable instead of printing them outright . Because when it comes to programming, you're more likely to process daughter before you put it. When getting daughter from a user, the default is set to string values only. However, this could be easily sort with parsing and converting off the variable value. But for now, let's get a string value from the user, such as your name. That's great, a string gold name. And instead of starting a new land, we go straight to equals. Consul don't read line. We have our brackets and we close the semi cone. This could once run will ask the user to Internet value before the following code is ever executed. So it's better to display a message before so before the variable name. It's great. A simple council dot right and inside the double quotations will be asking user to enter their name. So let's run up program and see for works of it is asking us to internal name. You notice there's a blinking under school representing us as the user being able to intend a valley now, seen as we're working for string our intern. The string such as Joe for the example. Press enter. I noticed nothing is printed and the program ins. Now let's improves this program with an output to using this variable so we'll create another consulate on the right line. This time inside, we'll just have another simple output, such as my name is Space After Plus Name Close the semi colon. We'd run a program again, Say I entered in Joe and a Prince. My name is Joe and the program ins. And just like that, we're receiving user input. But this is with the string. So what about an interview? Well, let's change all the varies. Accordingly, we can ask the user to into in it'll age we change the variable name and top two int age equals and now as you notice there's Redland underscoring it. That is because it is our putting a string. Therefore we need a pass it. So let's pass it with the integer part salon interest, dot pass and encapsulate The council read land in a set of brackets and now in the Consul right land for our final output, we can say my age is plus age. You run out program. Let's enter in value, such as 15. It says My age is 50. So our program is working correctly. It's story in the daughter and are putting it fun and how we know it's an inter jurors by simply adding to the valley so we can encapsulate age in another set of brackets, we can add 10 to it, run our program. Let's enter in 30 this time at Prince 40. So it is in fact, an integer. So we've converted a user input from its default of string to interject, and that is how you receive user input that concludes this lesson In the next video. I'll be explaining the project for this course 13. Project Discussion: Hello and welcome to your basic see shop course with visual studio. And in this video, we're going to be discussing the project for this course. For this project, you're to create a program called Ticket Tester for this program. You're gonna ask the use of five times to enter in an age yielding to use an if statement to check the age to see if it is above 18 not inclusive off 18. Once you have checked the daughter, you should print out the results as follows. You should print out the age colon space, and if it is above 18 entry, if it is below 18 no entry in this program you are to use to if statements and a single wild you're tourists or keep count of how many are allowed entry and how many are not allowed injury. At the end of this program, you're to print out the results as follows. The number off harmony are not allowed entry, the amount you're allowed entry and then finally, a percentage of how many made it into the program. For example, if three are allowed entry, 60% made it into the program here. Some tips to help you get started of this program. You'll need three initial inter parables, one to keep count of the no entries, one to keep count off the entries and another count for the wild. Both if statements should be inside the while loop with 1/4 integer to stall the users into the age. Your final outputs should be at the very end of the program that concludes this discussion in the next video. I'll give you my answer to this project. 14. Project Answer: Hello and welcome to your basic see shop course with visual studio. And in this video, I'm going to give you my answer to this course is Project First. Let us create our project file new Project Windows Classic desktop console application. And, as stated in the previous video, we're going to call our project program ticket tester and click OK and let's get straight into our program. First, we have to take care of those initial interview variables. Want to keep count off the no injuries? That's meant no entry equals zero. For now, we're great. Want to keep count of the entries? Zero. And finally a counter for the Wild. Now that we've created out variables, let's go straight to the wild. It is possible for you to you make use of a full loop. But seen as this is the requirement for the program will be using a while loop. Instead, Buzz will work the same way. Now we want to have the loop run five times. So while count is less than five within, create a section to play Salman code. The next part of the program is getting the user to anti in an age so he creates an integer to suit just that into age. And, of course, we need a pass it if we're gonna get user input. So that's int Dr Pass set of brackets console not read. Lon another city brackets closer, the semi colon. And of course, we needn't have a message displayed before. So let's off to use it to intend an age. So that's consul dot right blanc and in the message enter and age. So that should take care of kidding the value from the user. And now we got to check this fairly to see if it is above 18 not inclusive off 18. So we create an if statement if age is greater than 18 and then we use a sit brackets, we add one to entry. CNN is it is above 18 and recreate the output, which suits it. So that's council Don't right. Alarm has stated in the previous video we need to print the age followed by a colon, a space entry close to the same account. Now you have a choice to either create an else for a second if statement, what may seem simpler to use and else we're gonna be using a separate if statement this second, if statement is used to check to see if the daughter is not garbage. This being a programming term, full garbage in garbage out. So to ensure that the user doesn't into in any band doctor, we go if age is greater than or equal to zero, and age is less than and equal to 18. No entry. So that's no entry blast. Plus, seen as this includes all ages between zero and 18 this is the best way to make an efficient program. We didn't create the suitable output console. Don't write one age plus colonel space, No entry close to the same you come on. And finally we add to our count favorable count plus plus having completed all arm core code And now we go to our final output, which will be outside the wild. The first thing that we need a print is harmony on not allowed entry. So it's council dot right blanc. No entry plus double quotation space are not allowed entry. Now we simply copy this land to save us a little bit of time, paste it and adjusted two instead of no entry entry and instead of are not just our and now for our final are put council dot right lon, open up a set of brackets and another set of brackets, which will include a math function entry Tom's 20. This will help us get the percentage of harmony are allowed entry plus double quotations. Percentage symbol off testers made it into the program close with the same me going on. And there you have an answer to this course is Project. Just run the program and tasted out control a farm and asks us, Tintin and age, Let's enter in far values off below the age mark such as 15 15 No entry asks, are stainton another 10 results the same and three more values such as 567 and there we have our fun output. Fouls are not allowed entry. Zero are allowed Entry therapists into the testes. Made it into the program. South program for this part works correctly. Now let's do far values off above the age mark such as 50 which is a lot entry. 19 entry 25 city and 27 zero are not allowed entry. Far are allowed entry 100% of test has made it into the program. And now for the final test for very daughter, enter in an age, let's put in 18 which should be no entry, which it is indeed, but 19 again, another low mark, a hard look and another hammock. Just that he found two are not allowed entry, which is correct. That will be the five monk and the 18 mark the raced our lot entry as this is, Yeah, three are allowed entry. 60% of the tasters made it into the program. So this program works and meets. All the requirements for this course is project. I hope you found this answer useful if you struggled with this project. However, if your program looks similar to man and works the same way there Congratulations. You have just completed your basic course on C shop with visual studio That concludes this lesson in the next video. I'll give you a summary of what you've learned throughout this course. 15. Conclusion: hello and welcome to your basic see shop course with visual studio. And I would like to start this video of saying congratulations. You have completed the course and the project and taking her first steps into the world of programming. From the beginning of this course, he had little to no programming knowledge. You don't know how to use the i. D in visual studio, but from the beginning of this course, you learn to how to get your I d e installer to your first line of code, the hello World Code, which is code that is now so simple to you having completed a project that is so much more advanced than that lan itself, you've learned several variable tops. You've lent out a process, doctor, you've learned how to receive daughter, which again is a very important thing in programming. With all these tools in hand, you're really to create more basic programs. And I hope this introductory course helps you in the future when you seek more advanced lessons and training in C sharp programming