C# · Chapter 3.1 · Basic level
C#'s 3 Golden Rules & Console.WriteLine()
C# के 3 सुनहरे नियम और Console.WriteLine()
Welcome to C# (pronounced 'C-Sharp') — Microsoft's super-fast language used to build 70%+ of mobile & PC games in Unity (Subway Surfers, Temple Run, Genshin, Hollow Knight)! Don't get scared by the wrapper lines — let's understand EVERY word once and forever:
1. Semicolon ; Rule: Just like English sentences end with ., every C# command MUST end with ;!
2. Capital Letters Rule: In Console.WriteLine(...), C, W, and L are ALWAYS Capital!
3. Curly Braces { } Rule: Every block starts with { and closes with }.
C# ('सी-शार्प') में स्वागत है — दुनिया के 70% से ज़्यादा मोबाइल और PC गेम्स (Unity Engine) इसी भाषा से बनते हैं! इसके शुरुआती शब्दों से बिल्कुल मत घबराओ — आज हर एक शब्द का मतलब हमेशा के लिए समझ लो:
1. सेमीकोलन ; नियम: जैसे हिंदी में पूर्णविराम । लगता है, C# की हर कमांड के अंत में ; लगाना 100% ज़रूरी है!
2. कैपिटल अक्षर नियम: Console.WriteLine(...) में C, W, और L हमेशा बड़े (Capital) अक्षर में होते हैं!
3. कर्ली ब्रैकेट { } नियम: हर कोड ब्लॉक { से शुरू और } पर बंद होता है।
Words and symbols in this chapter
using System;- Brings Microsoft's basic
Systemtoolbox (which containsConsole) into your game. - Microsoft का बुनियादी
Systemटूलबॉक्स (जिसमेंConsoleरखा है) आपके प्रोग्राम में लाता है। class Program { ... }- Main container blueprint named
Programthat holds your code. Programनाम का मुख्य कंटेनर/डिब्बा जिसके अंदर सारा कोड रहता है।static void Main()- Entry Gate — when you press Run, the computer ALWAYS starts reading inside
Main()! - मुख्य दरवाज़ा (Starting Gate) — Run दबाते ही कंप्यूटर सबसे पहले
Main()के अंदर से चलना शुरू करता है! Console.WriteLine("...");- Prints a message on the Console AND makes our 2D Game Hero speak it! (
C,W,Lcapital!). - कंसोल पर मैसेज छापता है और गेम हीरो के स्पीच-बबल में बुलवाता है! (
C,W,Lकैपिटल!)। ; (Semicolon)- C#'s full stop — mandatory at the end of every command line.
- C# का पूर्णविराम — हर कमांड लाइन के आख़िर में लगाना अनिवार्य है।
Ready example
using System;
class Program {
static void Main() {
Console.WriteLine("Hello Future Game Developer!");
}
}
What you will see: In the Mini 2D Game Stage, our Hero waves and speaks your exact message inside a comic speech bubble!
मिनी 2D गेम स्टेज पर हमारा हीरो हाथ हिलाएगा और स्पीच बबल में आपका लिखा मैसेज बोलेगा!
Line by line
using System;- Loads the standard
Systemlibrary. Systemलाइब्रेरी लोड करता है।class Program {- Opens the
Programclass container. Programक्लास का ब्लॉक खोलता है।static void Main() {- Opens the
Mainstarting point of the program. - प्रोग्राम के शुरुआती दरवाज़े
Main()को खोलता है। Console.WriteLine("Hello Future Game Developer!");- Prints the greeting and shows it in the Hero's speech bubble!
- मैसेज प्रिंट करता है और हीरो हाथ हिलाकर यही डायलॉग बोलता है!
} }- Closes
Main()first, then closesclass Program. - पहले
Main()बंद किया, फिरclass Programबंद किया।
Common mistake
✗ Wrong
console.writeline("Hello")✓ Right
Console.WriteLine("Hello");C# is strictly case-sensitive (C, W, L Capital!) and every statement ends with a semicolon ;!
C# में Console.WriteLine के C, W, L बड़े (Capital) होने चाहिए और अंत में सेमीकोलन ; अनिवार्य है!
Your task
Write Console.WriteLine("Main C# seekh raha hun!"); (don't forget ;!) and click ▶ Run & Preview!
Console.WriteLine("Main C# seekh raha hun!"); लिखो (आख़िर में ; लगाना मत भूलना!) और ▶ Run & Preview दबाओ!
- Inside
Main(), writeConsole.WriteLine("Main C# seekh raha hun!");.Main()के अंदरConsole.WriteLine("Main C# seekh raha hun!");लिखो। - Check that
C,W,Lare Capital and;is at the end.
जाँच लो किC,W,Lकैपिटल हैं और अंत में;लगा है। - Click ▶ Run & Preview to hear the Hero speak!
▶ Run & Preview दबाकर हीरो को बोलते देखो!
Starter code for the task
using System;
class Program {
static void Main() {
// TODO: yahan Console.WriteLine("Main C# seekh raha hun!"); likho
// Yaad rakho: C, W, L capital hain aur aakhir mein ; zaroori hai
}
}Do this task in the classroom: your code is checked automatically and you get hints if something is missing.
Recap
- Every C# statement ends with a semicolon
;. - C# is case-sensitive: in
Console.WriteLinethe C, W and L are capital. - Blocks live inside curly braces
{ }, and the program starts instatic void Main().
- C# का हर statement semicolon
;पर ख़त्म होता है। - C# में बड़े-छोटे अक्षर मायने रखते हैं:
Console.WriteLineमें C, W और L कैपिटल हैं। - Blocks curly braces
{ }के अंदर रहते हैं, और प्रोग्रामstatic void Main()से शुरू होता है।
Quick quiz
Every normal statement line in C# must end with which character?
C# में हर सामान्य कमांड लाइन के अंत में कौन-सा चिह्न लगाना अनिवार्य है?
Show the answer
Answer: C (; (Semicolon))
Semicolon ; acts as the full-stop at the end of C# statements!
सेमीकोलन ; C# में वाक्य के पूर्णविराम (Full-stop) का काम करता है!
Practice problems for this chapter
- Fix the Game Loading Screen (3 compile errors)
गेम लोडिंग स्क्रीन ठीक करो (3 compile errors)
Solve them in the Practice Zone, where each answer is checked automatically and two hints are available.