4
I usually use always with keys because until today I do not know how exactly is the function of if without keys and if Else can also be without keys. Is there any variation in behavior between javascript and C#? and other languages?
Some examples that would confuse me whether or not they work:
Example 1:
if(true)
variavel = 55;
else
variavel = 100;
Example 2:
if(true)
variavel1 = 55;
variavel2 = 40;
else
variavel1 = 100;
variavel2 = 150;
Example 3
if (true)
variavel1 = 55;
else{
variavel1 = 100;
variavel2 = 200;
}
Simply when the instruction you need to validate is done on a single line, after the first line what comes will not be within your if or Else. the ideal is always to use.
– Marco Souza
All these examples work (compile), may not do what you want. So always use keys.
– ramaral