emojicode / emojicode

πŸ˜€πŸ˜œπŸ”‚ World’s only programming language that’s bursting with emojis

Home Page:https://emojicode.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

commented

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 β†˜οΈ (if), ⬇️ β†˜οΈ (else if) β†˜οΈ (else). But not really sure about this...

@idmean I don't see how you are supposed to distinguish if from else. Is this a typo?

commented

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?

commented

My idea is to just replace the πŸ‹ emoji with two emojis: ⬇️ β†˜οΈ. This is, however, unlike C, for example, since else (⬇️) always requires a code block and ⬇️ β†˜οΈ cannot work as else if does in C. Hence ⬇️ β†˜οΈ must be directly built into the language.

commented

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?

commented

@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?

commented

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.

commented

Looks great to me. Unless somebody comes up with something way better, we’ll go with this.