-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration suggestion for else-if statement #365
Comments
或若,君以为何如? |
@lymslive My original idea was to use 或若, but 或若 could be used independently meaning only "if" (as in 《敦煌變文集· 前漢劉家太子傳》:“汝緣年少,或若治國不得, 有人奪其社稷者,汝但避投南陽郡。”), so I chose 又若 that carries the character meaning "and". |
I don't think it's problem. |
I think neither 又若 nor 或若 is conventionally used to mean "else if", so we can probably decide based on the semantic of the characters themselves (unless someone come up with another phrase). Among the two, I personally prefer 或若 slightly more, since I feel like 或 hints the fact that it's an "either-or" relation, whereas 又 is more like "additionally". But I'm happy to hear more discussion :) |
Here update argument. if (cod1) {
state1;
}
ese if (cod2) {
state2;
}
else {
state3;
} is truely equivalent to if (cod1) {
state1;
}
ese {
if (cod2) {
state2;
}
else {
state3;
}
} Because Now back to wenyan-lang,
The only strange view may end with tow While on other hand, we can easily know how many Then it's term for editor plugin to reformat |
@lymslive You're exactly right. Languages like C and JavaScript gets I think 也也也 is very ugly and sounds like "yeah yeah yeah" or "yay yay yay" and goes against the philosophy of this language. We can mitigate the issue by using 云云 and 也 alternatingly (that's in fact why 云云 is added as an alias keyword). I understand your point that code with too many branches are ugly anyway, but I think a series of else-if's are sometimes necessary, especially since we don't have switch statement yet. In summary I think a separate Thanks! |
Thought it may not related to this issue, I'm curious And no matter how to implement, I image that it is still hard to treat nest loop and if case. For example, two Some times we seams no way to tolerate, and balance tradeoff. |
@lymslive |
I agree |
我还是用中文跟你讨论一个有关汉语的特有现象吧,前面看到你说 "alternatingly" 还以为你是想要找那样一个可轮换叠韵且意义相同的词组。 汉字大部分是单音节字,一个汉字能表示一个意思,但也有极少部分是双音节词(多音节词就更少了),它单独一个字没法表示意义,须两个字合起来才能表达意义,例如:
我以为你要为多层嵌套的 这种语义说起来其实是很适合多层 但古汉语中有没有类似的词组,我也一下子想不起来,集思广义吧。
以
(开心娱乐下 ^_^) |
😄 |
It seems that recently the only way to write else-if clauses is to write it as two blocks -
I have a suggestion on integrating such into one using 又若 (= or if) or something similar:
(The screenshot is edited using image editing software, not the display of the IDE)
The text was updated successfully, but these errors were encountered: