A very important concept in programming is what we call variable scope. Though this concept should have been explained when I explained variables, it wouldn’t have made much sense back then, because it was relying on stuff we did not yet explain.… Read more
Posts Tagged ‘declaring and initializing variables’
Variable Scope
Saturday, April 15th, 2017Initialization of arrays
Friday, March 31st, 2017Like any other variables, arrays must be initialized before we can access and use an element of that array. In C#, initialization of arrays is done automatically with default initial values. For numeral types, the default initialization value is 0, False for bool type, null for reference types, etc.… Read more
Var keyword
Thursday, December 29th, 2016In the previous lessons, I’ve said that when declaring a variable, we are required to indicate the compiler the type of the variable and its name. These kind of variables are called explicitly typed variables:
1 |
int integerVariable = 123; // explicitly typed variable |
However, this is not entirely true.… Read more
Declaring and initializing variables
Monday, December 26th, 2016The next topic in our lessons will be declaring and initializing variables. What do those terms mean?
As we already said in a previous lesson, declaring a variable means creating a new variable, by telling the compiler its type and its name.… Read more