| 有无 | 大括号 | 小括号 |
|---|---|---|
| 有 | A | B |
| 无 | a | b |
| else if | elseif | elif | elsif |
|---|---|---|---|
| @ | # | $ | % |
if condition:
"Google"
elif condition2:
"Apple"
else
"Github"
if condition
"Google"
elsif condition2
"Apple"
else
"Github"
end
if condition {
"Google"
}
else if condition2 {
"Apple"
}
else {
"Github"
}
if (condition) {
"Google";
}
elseif (ocndition) {
"Apple";
}
else {
"Github";
}
if condition {
"Google"
}
else if condition2 {
"Apple"
}
else {
"Github"
}
if(condition)
"Google";
else if(condition2)
"Apple";
else
"Github";
if(condition){
"Google";
}
elsif(condition2){
"Apple";
}
else{
"Github";
}
if (condition1) {
"Google";
}
else if (condition2) {
"Apple";
}
else {
"Github";
}
最近在学新语言,发现 if else(?)不会写了,作者在创作语言的时候是怎么确定这部分的呢?
同时找到 JavaScript 与 Java 是兄弟的证据!
1
xjtlujoe 2015 年 12 月 30 日
nice
|
2
Zirconi 2015 年 12 月 30 日
铁证啊
|
3
sakeven 2015 年 12 月 30 日
```go
if condition { "Google" } else if condition2 { "Apple" } else { "Github" } ``` 不能换行 |
4
hitmanx 2015 年 12 月 30 日
你把 c 加上括号不是一样吗?...
|
5
liuxey 2015 年 12 月 30 日
仔细看 Go 和 Swift ,是一对新的基友
|
6
plqws 2015 年 12 月 30 日
这帖子简直了,我会发现 C C++ Java C# JavaScript Golang Swift Rust 都是亲兄弟
|
7
ly710 2015 年 12 月 30 日
php elseif 和 else if 都可以
|
8
timsims 2015 年 12 月 30 日
if else 会写,但总是记不住哪些语言是 elseif 哪些是 else if
|
9
dapang1221 2015 年 12 月 30 日
哈哈哈,终于有人吐槽这个了
|
10
luman 2015 年 12 月 30 日
让我烦恼的却是
a=b a == b a is b {a:b} |
11
chairuosen 2015 年 12 月 30 日
shell 还有个 fi 老忘了写
|
12
iyaozhen 2015 年 12 月 30 日
@chairuosen 哈哈,这个真是日了狗了
|
14
JamesRuan 2015 年 12 月 31 日
来个 Erlang :
if condition then "Google" else if condition2 then "Apple" then "Github" end 但是,一般都这样用 case Condition of condition -> "Google"; condition2 -> "Apple"; _ -> "Github" end |
16
10iii 2015 年 12 月 31 日
js 的大括号规则和 C 是类似的,单语句的话可以不加,所以 LZ 上面整理的不正确。
|