语言 | javascript | python | ruby | ||||||
条件循环 |
if ( ) {·····} else if ( ){······} else{·····} |
if ·········: ·········· elif········: ··········· else : ··········· |
if·········· ··········· elsif······· ··········· else ··········· end | ||||||
打印 | console.log("·····") | print ······ |
| ||||||
注释 |
|
|
| ||||||
片段 | A.substring(0,3) | ||||||||
方法 | A.length |
|
A.length A.reverse A.upcase A.downcase A.capitalize! | ||||||
连结 | ”·····“+”·······“ " "," " | ||||||||
函数 |
|
def A ( ) : ············ | |||||||
替换 | print %s %("···") | ||||||||
大小 | true / false | True / False | true /false (随意 ) | ||||||
布尔 | ! / && / || | not / and / or | ! / && / || | ||||||
循环 |
for(i=0 ; i<8 ; i++) { ··················} |
| |||||||
自运算 |
x++ x+=2 【+-*/】 |
x*=2 【+-*/】 |
x+=2 【+-*/】 | ||||||
数组 | [ ] |
[ lists ] {key1:a, key2:b} list.append( ) list.sort( ) list.remove( ) len( list ) residens[ ] index[ ] dictionary[ 'key' ]=sth del dic_name[ key_name ] range( ) | [ arry ] { hash } | ||||||
简写 | ·····? A : b | ||||||||
弹出 | prompt | raw_input | gets.chomp | ||||||
导入模块 | from module import function | ||||||||
数学函数 | max( ) min( ) abs( ) type( ) | ||||||||
特色 | A.method1.method2 | ||||||||
打印衔接 | “A”+“B” | “A #{B}” | |||||||
迭代 |
| ||||||||
其他 |
for X in array : ················· for i in (0,range(x)) | 10.times{ do sth } |