Learned something new today , conditional statements are executed from top to bottom, if the bottom one is true, it will override everything on top of it.
Wanted to share this, it might seem silly and obvious for some but I had to learn it the hard way.
Moving the bottom conditional statement to the top, will override the New Seller status and apply the months active.
5 Likes
Thanks, I’ve coded a lot of arguments inside of the conditional statements on a previous project because I didn’t knew this, seems so obvious though
That’s something I never thought or noticed. Were you just playing around and found it?
Yes, let me show you the result.
and
Thats nice! It looks very professional and modern.
It would be nice if it didn’t override everything else.
Haha Thanks,
I’m building a marketplace template.
Maybe I could be a tester if thats ok with you?
1 Like
Well it actually is nice, because that’s the default behavior as well in traditional coding.
Yeah, I learned about this recently as well. Contacted Bubble support about a bug that my conditional to change the button color on press was not working, although the on hover conditional was.
Support sent it to an engineer after being able to reproduce the issue.
Engineer got in touch and explained the override issue there…so when my on press conditional was at the top and the on hover was on the bottom my on press conditional didn’t work but the on hover did…
when I put the on hover conditional at the top and the on press conditional at the bottom the on press and on hover conditionals worked appropriately.
1 Like
It’s important to note that once a condition evaluates to true, the subsequent conditions are not evaluated, and their corresponding code blocks are skipped. This behavior can be useful for creating cascading or prioritized conditions, where the order of the conditions determines the outcome.
However, it’s also important to design your conditional logic carefully to ensure that the intended behavior is achieved. If you have specific conditions that need to be evaluated independently or need to prioritize certain conditions over others, you may need to adjust the order of your conditions or use additional control structures to handle the logic accordingly.
2 Likes
It seems you’ve stumbled upon a little nugget from the past. The reason that we created this topic was for the fact that Bubble once in a time was using the bottom ones to overwrite the latter.