Coding 101

Jan 30th 2014

Coding 101 2

while (c101 > awesome)

Today we learn all about variables, while loops, and converting integers to binary.

Although the show is no longer in production, you can enjoy episodes from the TWiT Archives.
Guests: Louis Maresca
Category: Help & How To

Welcome to Coding 101 - It's the TWiT show that gives YOU the knowledge to live in the wonderful world of the programmer. This week we are taking a look at downloading Visual Studio Express, using github, and some simple Console Commands. You can also check out our transcript here.

Snubs, Compiled

How do I download and compile my first code?

Download the C# Compiler from the Visual Studio website.

  • Go to this site then:
  • Select "Express 2013 for Windows Desktop"
  • Download and Install! Follow the on screen direction to install.

How do I start my first C# program?

  • Open Visual Studio for Desktop ---> File ---> New Project ---> C#

How do I use GitHub?

  • Copy / Paste the code into the IDE (Integrated Developer Environment) which is Visual Studio.

How do I use the Console Command?

Our example includes four lines of code, and you can include in the body of your IDE.

  • Console.Write("Hello World!");
    • This will print a line that says Hello World!
  • Console.WriteLine("What's Up!");
    • This will print a line that says, What's Up! THEN it will move the cursor to the line below.
  • String Horses = Console.ReadLine();
  • Console.Write(Horse);
    • These two lines will wait for user input, and then an ENTER key. It will then take that input and put it into the "Horse" string variable. Then it will print on screen the value stored in that variable.

Find the Code for ALL of our episodes HERE!

Ivory Tower!

Variables

A Variable is a storage location that contains a known or unknown piece of data

  • A variable uses an identifier, a symbolic name, to reference this piece of data.
  • Example: y + x = a
  • In Programming, we have different types of vaiables that each can store different types of data.
    • Integer, Floating Point, Character, Strings of Characters -- each of these is a variable that can allow the program to reference a specific type of data.
    • The reason why variables are important is that they allow us to setup operations based on the value within these referenced storage locations. This means we can create programs that can run against ever-changing and user-inputed variables.

While Loop

Loops are programing statement that allows code to be executed indefinitely

  • While Loops allow code to be executed indefinitely based on a boolean condition.
  • In other words, I can set a condition that is checked on each loop, "each iteration" of the loop. -- If that condition is true, the loop runs. When the condition becomes false, the loop stops.
  • A "While Loop" is a pre-test loop... meaning that the condition is checked before the code within the loop ever runs. That means it is possible for the code inside a while loop to NEVER run.

Converting Integers into Binary

  • Start with a quotient, divide it by 2.
  • Write the dividend BELOW the quotient, then to the side, write the remainer. (It'll either be "1" or "0")
  • Repeat the process until your quotient is either "1" or "0" - at which point, write that value to the side.
  • Now READ the sequence of remainders from bottom to top, writing them from right to left
  • That is your Binary Value!

Get in Touch With Us!

Download or subscribe to this show at https://twit.tv/shows/coding-101.

Bandwidth for Coding 101 is provided by CacheFly.