Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why have confusing syntax?
Message
 
 
À
29/10/2008 14:43:46
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual C++
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01358131
Message ID:
01358135
Vues:
19
>I got the information below from a training/video site I subscribe to. Why would they make a language harder to understand than is needed? What is the reason for having "++" to add 1 and "+=" to add 10? Why not just i+1 or i+10? Doesn't make sense to me. And, this actually is C#, not C++, but I didn't see a C# forum. Unless they are the same?
>
>int i = 0;
>// convert from a string
>int i = int.Parse("1");
>// convert froma string and don’t throw exceptions
>if (int.TryParse("1", out i)) {}
>i++; // increment by one
>i--; // decrement by one
>i += 10; // add 10
>i -= 10; // subtract 10
>i *= 10; // multiply by 10
>i /= 10; // divide by 10
>
C# is in .NET forum.

Also it is important in C# (C++) where do you put ++ or -- (before or after the variable). It changes the sequence of what comes first.
There are several complex operators in C#.

See them C# operators with explanations.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform