Skip to main content
Ivan_jangoux
New Participant
Jul 8, 2023 12:20 AM UTC
Question

Validating two variables (nested conditionals?)

Is it possible right now to check for two conditions to run an action? I.e. If a=1 and b=1 then do action

Thanks

This topic has been closed for replies.

3 replies

tank666
Jul 8, 2023 12:27 AM UTC

Yes, of course, you can write such a condition.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Avokadomos
Figma Ambassador
Figma Ambassador
Jul 8, 2023 12:53 PM UTC

This is a completely valid condition to write in the condition field:

if a == 1 and b == 1

Disclosure: I’m part of Figma’s Forum Ambassador program.
Adrian_Ward
Jul 21, 2024 7:28 AM UTC

I’d like to point out that what @Ivan_jangoux was requesting was not nested conditionals, but compound conditionals (where more than one variable is compared in a single statement, combined with a boolean operator such as AND or OR etc).

As of mid 2024, there is a very genuine need for actual nested conditionals (where the outcome of a first comparison dictates what other comparisons might be made, each of which have their own outcomes). This is sorely lacking from Figma and a huge limitation when implementing any kind of prototype that isn’t basic. Currently, it isn’t possible to add another Conditional as the outcome of the “then” or “else” of a parent Conditional. You can only set a variable, navigate, etc. This is a huge limitation.

Working around such limitations results in overly complex prototypes and buggy statements that are frustrating and difficult to maintain.