CodeGym /Courses /C# SELF /Commands and Your First Program

Commands and Your First Program

C# SELF
Level 1, Lesson 1
Available

1. Getting to Know Commands

If you ever thought being a programmer was something mysterious and impossible to understand, it’s time to bust that myth! Programming isn’t some secret art, it’s a cool and super interesting job. And you’re about to see for yourself.

Computer programs are written using programming languages — special rules and words that computers get. Today you’ll meet the C# language: you’ll write your first program, figure out what commands are, and make your computer listen to you (well, as much as it wants to, anyway). 😅

A program is just a set (a list) of commands. First, the first command runs, then the second, then the third, and so on. When all the commands are done, the program ends.

What commands can be in the list depends on who’s running them, or more exactly, what commands the performer knows (and understands). You can tell a dog “Sit”, “Speak”, a cat — “Shoo”, a person — “Stop!”, and a robot — “Work!”. 👨‍💻

A command is just a simple instruction to the computer: do this! The most important thing — the computer does exactly what you tell it, not what you want. 😆 At least until AI grows up a bit more.

The set of commands in C# is pretty big. For example, this command prints a message on the screen:

Console.WriteLine("Robot is a human’s friend");
Command to print text on the screen

This command tells the computer: “Print the text "Robot is a human’s friend" on the screen.”

If you want the computer to print your phrase three times, just give it the command a few times.

Console.WriteLine("Robot is a human’s friend");
Console.WriteLine("Robot is a human’s friend");
Console.WriteLine("Robot is a human’s friend");
Program with three commands

As a result, the computer will print the phrase 3 times. That’s it. 😎

2. How a Program Works: Execution Order

Your program just runs all the commands from top to bottom, line by line. When the commands run out, the program ends.


Console.WriteLine("Hey, everyone!");
Console.WriteLine("Today we’re learning to code in C#!");
    
Example program with two commands

Result:

Hey, everyone!
Today we’re learning to code in C#!
What the user will see in the output window

Add a couple more lines, and the computer will obediently print them out. It’s super hardworking, but humble — it won’t write anything extra.

3. Writing and Running Your First Program

Why put off a good thing? Time to go from theory to practice! Let’s write your first program in C#.

Step 1: open WebIDE

Open WebIDE and write a program that prints "It’s awesome to be a programmer! 😎" on the screen.

You should have a file open called Program.cs.

Step 2: type in this code

You can totally use emojis — C# handles them just fine! 🥰

Console.WriteLine("It’s awesome to be a programmer!😎");
First command to print text

Step 3: send your program for checking

At the top of the WebIDE panel, you’ll see a "Check" button. Click it.

If you did everything right, the server will accept your solution and congratulate you. 😎

You just wrote and successfully submitted your first program in C#. Feels good, right? Now you’re a real programmer (well, at least one step closer to that title). 😇

2
Task
C# SELF, level 1, lesson 1
Locked
It's Cool to Be a Programmer
It's Cool to Be a Programmer
2
Task
C# SELF, level 1, lesson 1
Locked
Robot — Friend of Humans
Robot — Friend of Humans
Comments (1)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Hoist Level 1, San Diego, United States
7 August 2025
HINT: delete the period (.) on the end to run this ok >>> It's cool to be a programmer!😎