Syntax Comparison

From mi-linux
Revision as of 19:11, 23 January 2011 by In0316 (talk | contribs)
Jump to navigationJump to search

Students

This is a comparison of the syntax of some popular programming languages, including Scala which we will be using on 5CS004. Where you see the word "TODO", please collaborate to fill in the blank parts of the tables. We will be adding to this page as the module progresses.

Useful language references


Basics

PHP Java Scala Python
Single line comment
// comment
// comment
// comment
# comment
Multi-line comment
/* comment */
/* comment */
/* comment */
Doesn't have multi-line comments.
Null object
NULL
null
TODO
None
+,-,*,/,%,*
+,-,*,/,%,*
+,-,*,/,%,*
+,-,*,/,%,*
+,-,*,/,%,*
True and false
TRUE, FALSE
true, false
TODO
True, False
Boolean operators
&&, ||, !
&&, ||, !
TODO
and, or, not
Relational operators
<, >, <=, >=, ==, !=
<, >, <=, >=, ==, !=
<, >, <=, >=, ==, !=
<, >, <=, >=, ==, !=


Selection

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Iteration

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Compound types (arrays, lists, etc)

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Input / output

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Exception handling

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Dealing with types

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO

Classes, objects, methods, etc

PHP Java Scala Python
TODO
TODO
TODO
TODO
TODO