Life gets messy, and so do piecewise functions. What if you have three, four, or even seventeen pieces? No problem. Just keep adding lines. Each line gets its own curly-brace condition. Desmos treats each line as a separate rule of the game.
For instance: y = -1 {x < -2}, then y = x { -2 <= x < 2}, then y = 3 {x >= 2}. Three lines, three conditions, one happy graph. Just remember that order doesn’t matter—Desmos is smart enough to check all conditions.
Fancy Moves: Using Bold and Italic Conditions
You can get creative with your conditions. Want a function that only works when x is an integer? Try y = x {floor(x) = x}. That’s a neat trick for a discrete graph. Want it to work for exactly x = 5? Just type y = x {x = 5}.
Desmos to graph Piecewise Functions and Evaluate with Function Notation
You can even use logical operators like and and or. For instance, y = 1 {x > 0 and x < 1} will only show a line at y = 1 in the tiny sliver between 0 and 1. It’s pinpoint accuracy, and it feels incredibly satisfying.