If...Else...While...Do...My Code!

January 22, 2015    C# .Net Coding Programming

While I took some time off blogging through the holidays, I did not take time off coding. Additionally, I wanted to start including some of my files/projects that I am working on. I needed to know/figure out github to do that. I think that will be a large part of my next post.

If it wasn’t clear up till now, I am not as far a long on my blogging as I am in coding. I figure that it will allow me a little leeway if I get stuck on something, though currently I am much further behind than I would like. I hope to get a bit caught up in the next couple weeks. We will see, it all depends on how in-depth I feel I need to go in different subjects.

If/else and do/while is one of the main concepts that I gathered and retained in my little stint in Java. Doing if/else statements were the first thing that really made me feel like I was actually able to give the computer a command.

As part of these lessons on the Udemy C# for Beginners course, there is a live demo of coding a “Flip a Coin” console application. I followed along then went through and made modifications, tried different things, and added in a check to make sure that I got the input expected from the user.

I was really intrigued by the random number generator that able to be used. When I had gone through an exercise in Java, there seemed to be a bit more to get that basic number generator running. I have a couple ideas that i would like to do as I continue learning and that number generator is going to prove handy in doing it.

I figured out that a string is held to case sensitive values. I wanted to let the people that were trying out my application to be able to use a capital or lowercase letter. After a little research, I found that I could use the “   ” operator to take several values from the string and run the same code. I am sure there are other ways to do this, however this was the way that I found to get the result I was looking for at the time.

I went through using if else statements to write a small Rock, Paper, Scissors game. I later found out about ways to do this better, but at the time it was about figuring out the solution. The main trouble that I had, was figuring out how exactly to have the game sanitize the input, but also accept multiple types of what a person might consider the “same” input, i.e. Rock, rock, ect.

I have attached what my end result was and was successful at achieving what I wanted, though now look at it and know so many ways of doing it “better”.

More to come!

Files associated with this post