C# · Chapter 3.0 · Start Here level
Start Here: How a C# Program Runs (Compile → Run)
शुरुआत: C# प्रोग्राम कैसे चलता है (Compile → Run)
C# is a compiled language: before running, the compiler checks your WHOLE program like a strict exam checker. If even one ; is missing, it refuses to run and shows an error like CS1002: ; expected — so the output stays empty. That's good: mistakes are caught early! Every C# program has a fixed shape: class Program { static void Main() { ...your code... } }. Think of Main() as the main gate — the computer always enters there first. The same C# runs real Unity games!
C# एक compiled भाषा है: चलाने से पहले compiler आपका पूरा प्रोग्राम एक सख्त परीक्षक की तरह जाँचता है। अगर एक भी ; छूटा, तो वह चलाने से मना कर देता है और CS1002: ; expected जैसी error दिखाता है — इसलिए आउटपुट खाली रहता है। यह अच्छा है: गलतियाँ जल्दी पकड़ी जाती हैं! हर C# प्रोग्राम का एक तय ढाँचा होता है: class Program { static void Main() { ...आपका कोड... } }। Main() को मुख्य दरवाज़ा समझो — कंप्यूटर हमेशा वहीं से अंदर आता है। यही C# असली Unity गेम्स चलाती है!
Words and symbols in this chapter
Compiler- Checks the full program for mistakes before it runs.
- प्रोग्राम चलने से पहले पूरे कोड की गलतियाँ जाँचता है।
error CS1002- Compile errors have a CS number — search it to learn more.
- Compile errors का CS नंबर होता है — उसे खोजकर और सीख सकते हो।
static void Main()- The entry gate: execution starts on its first line.
- प्रवेश द्वार: चलना इसकी पहली लाइन से शुरू होता है।
{ }- Curly braces wrap a block: one for the class, one for Main.
- Curly braces एक block को घेरते हैं: एक class के लिए, एक Main के लिए।
Ready example
using System;
class Program {
static void Main() {
Console.WriteLine("Game shuru!");
Console.WriteLine("Player: Rohan");
Console.WriteLine(10 + 5);
}
}
What you will see: Your messages appear in the console and in the hero's speech bubble.
आपके संदेश console में और हीरो के speech bubble में दिखेंगे।
Line by line
class Program {- The container for our code.
- हमारे कोड का डिब्बा।
static void Main() {- Execution starts here.
- यहीं से प्रोग्राम चलना शुरू होता है।
Console.WriteLine("Game shuru!");- Prints a line; ends with
;. - एक लाइन छापता है; आख़िर में
;। Console.WriteLine(10 + 5);- C# calculates first and prints
15. - C# पहले जोड़ता है और
15छापता है।
Common mistake
✗ Wrong
static void main() {✓ Right
static void Main() {C# is case-sensitive: the entry point is Main with a capital M.
C# में बड़े-छोटे अक्षर मायने रखते हैं: entry point Main है, कैपिटल M के साथ।
Your task
Run once to see CS1002, add the missing ;, then print one more line with your name.
एक बार Run करके CS1002 देखो, छूटा हुआ ; लगाओ, फिर अपने नाम वाली एक और लाइन print करो।
- Run and read:
error CS1002: ; expectedon line 6.
Run करो और पढ़ो: लाइन 6 परerror CS1002: ; expected। - Add
;at the end of the WriteLine line.
WriteLine वाली लाइन के आख़िर में;लगाओ। - Add
Console.WriteLine("Mera naam: Simran");(your name) and Run.Console.WriteLine("Mera naam: Simran");(अपना नाम) जोड़ो और Run करो।
Starter code for the task
using System;
class Program {
static void Main() {
// Is line mein ; chhoot gaya hai — Run karke error padho, phir theek karo:
Console.WriteLine("Mera pehla C# program")
// TODO: ek aur Console.WriteLine likho jisme aapka naam ho
}
}Do this task in the classroom: your code is checked automatically and you get hints if something is missing.
Recap
- C# is compiled: one mistake and nothing runs — read the CS error.
- Every program:
class Program { static void Main() { } }. - Statements end with
;and blocks live inside{ }.
- C# compiled है: एक गलती और कुछ नहीं चलता — CS error पढ़ो।
- हर प्रोग्राम:
class Program { static void Main() { } }। - हर statement
;पर ख़त्म होता है और blocks{ }में रहते हैं।
Quick quiz
A C# program has one missing ;. What happens?
C# प्रोग्राम में एक ; छूट गया। क्या होगा?
Show the answer
Answer: B (The compiler shows an error and nothing runs)
Compile errors stop the whole program before it starts.
Compile error पूरे प्रोग्राम को शुरू होने से पहले ही रोक देती है।
More practice at this level
- Fix the Game Loading Screen (3 compile errors)
गेम लोडिंग स्क्रीन ठीक करो (3 compile errors) - Game Hero Profile (data types)
गेम हीरो प्रोफ़ाइल (data types) - Railway Ticket Fare (if / else if / else)
रेलवे टिकट किराया (if / else if / else)
Solve them in the Practice Zone, where each answer is checked automatically and two hints are available.