from:http://www.cnblogs.com/liuyunfeng/archive/2012/07/31/2616537.html
数据类型
这里数据类型指的是内部数据类型,不考虑语言内部的自动转换。
| C++ | java | javascript | php | python | ruby |
基本类型 | bool char int, unsigned, long float, double pointer | boolean char int, long float, double
| String Number Boolean | integer string float
| int, long, float, double | String Number Symbol |
逻辑操作 | &&, ||, ! | &&, ||, ! | &&, ||, ! 结果不一定是布尔 | &&, ||, ! | and, or, not | &&, ||, ! |
字符串操作 | strlen strcat substr | s.length s.concat s.substring s.matches | s.length + s.substr s.match | strlen . Substr preg_match | len + s[n:m] re.compile().match() | size + s[n, m] s.sub |
复合类型 | struct class union array | class array | array function 可当作对象使用 | array class | list dictionary tuple class | Array,Hash class |
语句结构
| C++ | java | javascript | php | python | ruby |
条件 | if/else switch/case | if/else switch/case | if/else switch/case | if/else switch/case | if/else/elif
| if/else/elseif |
循环 | for while do while | for/: while do while | for/in while do while | for foreach/as while do while | for/in while | for/in while
|
l模块 | Template function/class | function
| function 具有层级化的定义域 | function | Lamda function | Lamda block |
异常 | try catch throw | try catch finally throw | try catch throw | try catch throw | try: except: else: finally: | begin/end rescue ensure raise |
对象 | 基于类 多继承 | 基于类/接口 单继承 | 基于原型 可实现继承 | 基于类 单继承 | 基于类 多继承 | 基于类 单继承 |
s
s