Pascal (programming language): Difference between revisions

Content deleted Content added
mNo edit summary
m format tweak for clarity
Line 5:
 
== Unique Features ==
Unlike programming languages descended from C, Pascal uses <tt>:=</tt> for assignment instead of <tt>=</tt>. This is an advantage in differentiating comparisons and assignments. In C <tt>==</tt> is comparison, but <tt>=</tt> is an assignment. These can be easily interchanged resulting in an inline assignment instead of a comparison. This syntax leads to many hard to track bugs in C -style code. Since Pascal does not allow inline assignments and makes use of distinct syntax for assignments vs. comparisons these bugs cannot occur in Pascal.
 
Another major difference is that Pascal is strongly typed. This means that all variables must be defined with a specific type before they can be used. Also incompatible variable assignments are not allows without an explicit type-cast. This prevents common errors where variables are used incorrectly because the type is unknown. This also alleviates the need for [[Hungarian notation]] - the practice of suffixing variable names with type identifing letters.