Math Functions - Nested IF statement



We use the muparser math library.

There are functions available, like abs() There are built in constants, like _pi Also, there is an ‘if then else’ construct, example: “if (a > b) then y else z” is expressed by: ( a > b : y | z)

See these links for more info on what you can find in muparser:

Built-in operators:
Binary operators:
Ternary operators (if then else):


I saw this when you posted this before… this can be very handy where say the difference between waist and hips exceeds a given amount, 2 darts are used instead of one. Or on a taller person 6 buttons are used on a vest instead of 5.


hi, can someone help me to apply the if then else function? I tried, but I am not really getting anywhere. In excel I would type my goal like this: =IF(PK<=4;0,5;IF(AND(PK>=5;PK<8);1;1,5)) I copied the expression like stated above and tried, but it wont resolve. ( a > b : y | z) Can I achieve this with Seamly? For now it seems the program doesn’t like the colon. I replaced that with a semi colon, but then it didn’t like the straight dash (not sure, how that is called coorectly). Also, I tried with removing the spaces, but nothing seams to bee a proper function.

Thank you, Évi


Hi, I figured it out :slight_smile :slight_smile: It works with this expression ( a operation b )? c:d

In my case the formula is now like this

(@PK<=4 ?0,5:(@PK>=8 ? 1,5:1))


Hi @Evica! Fantastic nested if statement. Thanks for posting your solution.

  • if a<b then c else d looks like ( a<b ? c : d) in Seamly2D formulas.
  • if e<f then f else g looks like (e<f ? f : g)
  • When d is another test, then it looks like: ( a<b ? c : (e<f ? f : g) )