This blog post is in reaction to Shelby Aaberg's post at Matheleticism regarding defining piecewise functions, Read that posting first! I submit a simple solution that eliminates the complex solution supplied.
All we must do is take advantage of the fact that the truth value "false" yields 0, whereas "true" yields 1, and dividing by zero is undefined. Thus multiplying by the truth value equates to multiplying by either zero or one, and dividing by the truth value goes right along with that. So dividing by the truth value is the same as dividing by either 1 or 0.
The same works at Desmos, as shown in the second graphic below.