Change the conditional statements into more consistent and meaningful emojis
betseg opened this issue Β· comments
βοΈ Proposed change
Change conditional statements from π π π to β
π€ Rationale
I got inspired from the ternary operator β,
from CPL, later transformed into ?:
with newer languages. Fruits are cool but they don't control the control flow. Also if we call β
"if" and β
"else" then βοΈ
automatically becomes "else if".
πΊExample
(copied from docs and changed the proposed statements)
π¦ a 2
π¦ b 7
β βΆοΈ a b π
π π€a is bigger than bπ€
π
βοΈ π a b π
π π€a equal to bπ€
π
β π
π π€a is smaller than bπ€
π
I think this will conflict with #65. β and β could be used, but what about else if? One could also use the grey punctuation for functions and the normal one (shows as red for me) for conditional statements, but either way, I think it would be confusing.
Thanks for your suggestion.
@NieDzejkob is right about the conflict. β and βseems not ideal due to the somewhat bad contrast.
What I was thinking about once was something like
@idmean I don't see how you are supposed to distinguish if from else. Is this a typo?
Typo, sorry. Else should be β¬οΈ, of course.
@idmean so if you make the "else if" statement "β¬οΈ βοΈ
", then you remove the π
altogether because there is no need for it?
My idea is to just replace the π emoji with two emojis: β¬οΈ else if
does in C. Hence β¬οΈ
This could only be done if code blocks have a different syntax to closures. The docs laconically say:
A closure is created by a block of code that appears when an expression is expected.
Since every expression can be a statement allowing a statement after β¬οΈ etc. would technically allow a closure there.
I don't think, however, that such changes would be advantageous now.
Maybe the new U+1F9EA π§ͺ TEST TUBE
emoji in Emoji 11.0 (will be released on June 5, 2018) can be used somehow?
@betseg Interesting, but the thing is that even once the standard is released it takes time for vendors to actually provide the emoji.
However, thinking about this issue once again, I came up with this syntax:
βͺοΈ a π
π π€if aπ€βοΈ
π
πββοΈβͺοΈ b π
π π€else if aπ€βοΈ
π
πββοΈ π
π π€elseπ€βοΈ
π
- βͺοΈ matches other flow control statements like π, π and β©οΈ
- πββοΈ depicts "else" well, because the man seems disappointed, which kinda matches that this block is only executed when the previous condition evaluated to false.
π for else, because it says no?
You mean instead of πββοΈ
? Like so?
βͺοΈ a π
π π€if aπ€βοΈ
π
π
βͺοΈ b π
π π€else if aπ€βοΈ
π
π
π
π π€elseπ€βοΈ
π
Probably better because π is way easier to recognize.
Yeah I meant that.
Looks great to me. Unless somebody comes up with something way better, weβll go with this.