{
}
using System; namespace MyAwesomeProgram { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
int number = 1;
=
;
// one line comment
/* this is a multi-line comment */
bool
bool booleanValue = true;
int
int wholeNumberValue = 3;
double
float
float numberValue = 3.0f;
string
string text = "text is here";
const
const string text = "I never change!";
Debug.Log(textVariable)
Debug.LogWarning()
Debug.LogError()
+
-
*
/
%
Create a new Unity project for simple programming exercises.
Create a new C# script component inside an empty GameObject.
Declare two variables a and b with the type double.
a
b
In the Start() function, print to console four operations: the sum, difference, fraction and product.
Start()
What happens if either of them is equal to zero?
Microsoft's own C# Reference is a great way to dive deeper into the language.
Some basics covering the syntax in C# are covered here: