Chapter 1.1: C# Intro

Abish Pius
Apr 7, 2021

--

Learn by doing!

Challenge: Use 3 different variables to encapsulate the following message: “Hello, Bob! You have 3 in your inbox. The temperature is 34.4 celsius.”

var name = "Bob";
var n = 3;
var temp = 34.4;
Console.WriteLine($"Hello, {name}! You have {n} in your inbox. The temperature is {temp} celcius");

C# has a variety of data types and unlike Python you have to declare the type of variable you want to instantiate (ie. for an integer variable you have to use int <variable>; ). The syntax is mildly inconvenient, however, luckily you can be lazy and use the “var” declaration which automatically assigns a type to the instantiated object/variable.

Good Resources

Challenge — Learn | Microsoft Docs
Beginning C# Programming with Unity by A.T. Chamillard

--

--

Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer