EXERCISE: Basics

Basics

Printing exercise

Elektra wants to know your name and your school. Print them out on your console for her to see.

We’ll be watching a video that explains printing and commenting next. But let’s see if you can figure it out by yourself? 

But first, let’s unpack the C# code:

  • Code lines 1-6 are automatically required on C# coding platforms. You can ignore these for now.
  • Comments (in green): these are ignored by C#. We can use // for a single line or /* for multiple lines */ 
  • Line 9: Console.WriteLine(“print”) is how we print out something in C#.
  • Line 11: Console.ReadLine() is how we ask the user (you) to type something after you run the code.

Your instructions:

  1. On Line 16: Using Console.WriteLine code > Print “What is the name of your school”
  2. Click Run and enter your name and your school name when requested

Console – where your C# code goes. Click “RUN”.