One thing that is ambiguous to me is the implicit types of languages like python and c#. This makes Python so powerful but also very confusing AT THE SAME TIME! Python and C# are very different, one strong typed and another is weak, but it’s interesting to compare how they handle a non-explicitly variable declaration.
Btw, I always use the Microsoft official guide, it’s quite explanatory. Yes, I know proprietary stuff, but come on, C# is very useful and powerful too. The performance especially got better recently (a couple of years that is getting better already and GC too)
On the declaration of the variable, we don’t need to explicitly say what it is, since it’s weakly typed. On the example below, x and y are different types and are not explicitly stated.
x = 5
y = “John”
AND FOR ANONYMOUS VARIABLE: In python to use an anonymous variable, we use the _ –> underscore operator.
C# is a strongly-typed language! However, in C# we can use one trick to make it more flexible by using the Implicitly Type VAR!!
By using the keyword var on the declaration of a variable. It’s up to the compiler figure out what type of variable is actually on the declaration. But interestingly it must be declared and used on the same statement.
var i = 10;
int i = 10;
It’s possible to download straight the Programming Guide from Microsoft here .
In a table
Everything looks better in a table, so we have: