×

c# · level 1 · unit 2 · lesson 1

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

A ="button" class="pl-term" data-term="0" aria-expanded="false">variable is a box with a name on it.

A variable is a box your program keeps things in. You write a name on the label and put a inside. From then on, you say the name to get the value back.

In C# the label also says what kind of thing fits in the box. That is its type. string boxes hold text. boxes hold whole numbers, like 7 or 100.

So string name = "Sam"; means: make a string box called name and put "Sam" in it. To use the box, write its name with no quotes.

using System;

string name = "Sam";
int age = 9;
Console.WriteLine(name);
Console.WriteLine(age);

Read the = as put into, not equals.