literature.cafe
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
KaKi87@jlai.lu to JavaScript@programming.dev ·
edit-2
4 months ago

Ternary-based pattern matching in JS

blog.kaki87.net

external-link
message-square
6
link
fedilink
6
external-link

Ternary-based pattern matching in JS

blog.kaki87.net

KaKi87@jlai.lu to JavaScript@programming.dev ·
edit-2
4 months ago
message-square
6
link
fedilink
Folks are jealous of other programming languages having this kind of pattern matching abilities : fun compareNumbers( a: Int, b: Int ) = when { a > b -> "A is greater than B" b > a -> "B is greater than A" else -> "A and B are equal" } But, so do we : const compareNumbers
  • KaKi87@jlai.luOP
    link
    fedilink
    arrow-up
    1
    ·
    8 months ago

    Probably just my general dislike of verbosity 😅

JavaScript@programming.dev

javascript@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !javascript@programming.dev
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 3 users / day
  • 16 users / week
  • 68 users / month
  • 324 users / 6 months
  • 2 local subscribers
  • 2.65K subscribers
  • 259 Posts
  • 382 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • Ategon@programming.dev
  • nick@programming.dev
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org