In Levels.cs we only declare the variable breakableBlocks but we don’t initialise it.
Does that mean we can count on C# to always initialise an integer to zero when we declare it?
In Levels.cs we only declare the variable breakableBlocks but we don’t initialise it.
Does that mean we can count on C# to always initialise an integer to zero when we declare it?
Hi Frank,
You are right. In C#, all variables get initialised automatically with a default value if you do not initialise a variable yourself. For int, it’s 0; for float 0f, etc.
See also:
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.