PricingBlog

Simplest / Cleanest way to set a multiple condition

  • jehex-1286964619474370622

    Jehex

    1 year ago

    Hi there, I would like to know the simplest way to set a multiple condition, let's said
    I would like to set a specific value to a global variable depending the value of my input variable

    like if resolution = 1 then width = 1024
    if else resolution = 2 then width = 1156
    if else resolution = 3 then width = 1216

    Thanks you
    1286964619704926268-Untcitled.png
  • andreasmoller-1286966144816906260

    Andreas Møller

    1 year ago

    1286966144632094730-CleanShot_2024-09-21_at_10.23.472x.png
  • 282143925291057163-@Andreas Møller
    jehex-1286967664706719755

    Jehex

    1 year ago

    Thanks a lot Andreas, didnt know we can use object for this case! 😄
  • andreasmoller-1286968036779098177

    Andreas Møller

    1 year ago

    It’s a nice trick. Object are often called Maps in other languages because they “map” from one value to another other
  • jehex-1286968706701721672

    Jehex

    1 year ago

    Perfect,clear and clean 😄