0
Syntax alternative in a programming language.
Why do programming languages use different alternative but equivalent syntax for expressing the same statements? Example in c++, the following codes are equivalent 1. if (y<a){ x = b;} else {x = c} 2. x = (y<a)? b: c; What is the advantage of doing this? Could this be source of difficulty in learning programming language?
1 Odpowiedź
+ 2
This is a „feature“ of many programming languages. It is called „syntactic sugar“ which means, programming languages are made „sweeter“ by offering additional syntax, to make things easier. Some people criticize these features, because it makes programming or code analyzing more complex.