0

i can never understand the theme behind kotlin.

THEY DON'T HAVE A FUCKING TERNARY OPERATOR!!![?:]

Like before realizing this, i thought yeah jetbrains has decided to make android development a privileged hobby and non beginner friendly , so its now creating an encoding like language, in the false theme of " reducing code size"

But now they remove WORLDWIDE KNOWN, OPTIMIZED , EASY TO READ AND USE AND UNDERSTAND FEATURE of ternary operator and replacing it with less powerful but same looking elvis operator.( and stating that using if else for that is a better option)

Like why? if your goal is to make a shitty encoding language that makes everything shorter and most of the things optional, why remove the already efficient if else encoder?

God knows when this stupid language is going to stop my brain from getting blasted

Comments
  • 3
    Rust does not have ternary operators either. You can however do this:

    @highlight
    let y = match x {
    true => 5,
    false => 42
    } ;
  • 1
  • 0
    @olback
    I'm pretty sure rust also has ifelse-expression.
  • 0
  • 5
    The ternary operator IS usually the Elvis operator, and it is only necessary in languages where "if" is a statement and not an expression. That's because a statement doesn't return a value while an expression does.
  • 0
    @Fast-Nop meh. Sounds good, but i never gave a damn about if returning something. Most of the time one single if(){...} will have many lines of code .

    If i wanted a conditional to return something, ternary was my weapon of choice. And ternary on average was less used in the code than actual if else, and everything was quite sorted out:

    - wanna run multiple lines on a single condition? If else.

    - Wanna run 1 line for 1 condition? Ternary.

    - Wanna run 1 line of code for multiple conditions? Switch cases
  • 2
    @StopWastingTime The ternary was your weapon of choice BECAUSE "if" didn't return anything, and that's BECAUSE it was a statement.

    In a language where "if" is instead an expression, the ternary operator would be a pointless redundancy, and axing these is good design.

    In that scenario, the ternary is a workaround where the original problem that lead to the workaround doesn't exist anymore.
  • 0
    @highlight
    Ughh, pattern matching has gotten so good. I love living in the future.
  • 0
  • 0
    @highlight

    Fuck you! I am a bot
  • 0
    @StopWastingTime
Add Comment