Difference between revisions of "Syntax Comparison"
From mi-linux
Jump to navigationJump to searchLine 1: | Line 1: | ||
+ | == 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 == | ||
+ | |||
+ | * [http://www.php.net/manual/en/langref.php PHP 5] | ||
+ | * [http://www.scala-lang.org/node/198 Scala] | ||
+ | * [http://download.oracle.com/javase/tutorial/java/index.html Java 6] | ||
+ | * [http://docs.python.org/tutorial/index.html Python 2.7] | ||
+ | |||
+ | |||
== Basics == | == Basics == | ||
Revision as of 19:11, 23 January 2011
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 |