Skip to main content
Jerimy_Brown1
September 28, 2023

We could use IF, ELSE IF, ELSE statements?

  • September 28, 2023
  • 24 replies
  • 5042 views

We could use IF, ELSE IF, ELSE statements… Many times in code you may want to do many different things based on different string values

For example, I might have three different landing pages based on 3 conditions, and upon button press I might want to say

IF “has-users”==0 goto empty landing
ELSE IF “has-users”==1 goto landing a
ELSE IF “has-users”==2 goto landing b
ELSE goto other

24 replies

djv
Figmate
Community Support
September 16, 2024

Hey All, thanks for the feedback and sorry for the lack of acknowledgement here!

We’ll pass this onto our prototyping team for future consideration.

Terrence_Martineau_Nokia
New Member
September 18, 2024

It will work in some cases… but won’t work in some cases… example if in the Action you change the state of the thing you are testing for in the IF statement 😏

All the IF get evaluated one after another so if initially the state didn’t exist, one of the preceding actions could have changed it so it does and it all falls apart.

Vincent_Schlothauer
Active Member
March 7, 2025

This would be useful even just for relatively basic prototyping.

I’m trying to set up a group of segmented controls with variables and conditionals. The segments are a subcomponent which can have 1 of 4 selection states:

  1. “False”
  2. “Single” for when no adjacent buttons are selected
  3. “Multi | left” for when the segment is leftmost in a group of adjacent selected segments
  4. “Multi | right” for when the segment is rightmost in a group of selected segments
  5. “Multi | center” for when the segment is between other selected segments

For simplicity’s sake, I’ll show my issue based on a group with only two segments. The group can have four possible combinations:

  1. No segments selected
  2. The left segment selected
  3. The right segment selected
  4. Both segments selected

What I need is essentially this:

  • IF segment-1 = “False” AND segment-2 = “False”
    • Set segment-1 to “Single”
  • ELSE IF segment-1 = “False” AND segment-2 = “Single”
    • Set segment-1 to “Multi | left” AND set segment-2 to “Multi | right”
  • ELSE IF segment-1 = “Single” AND segment-2 = “False”
    • Set segment-1 to “False”
  • ELSE IF segment-1 = “Multi | Left”
    • Set segment-1 to “False” AND set segment-2 to “Single”

If I string these together as 4 separate IF statements instead, it simply won’t execute properly. From past prototyping projects I understand that Figma executes each action in turn. I’m assuming it’s because if clicking on an item sets it to “false” and the next action checks for “false” to set it to “true”, they simply cancel each other out.

 

Desislava_Slavkova
Active Member
November 12, 2025

Please add this! Such a basic thing. I don’t even think it needs justification of why it’s needed. Is basic coding feature. It’s for a good reason it exists in every major coding language.