Question: How to write function definition with multiple cases using braces?

Is there a way to write a function definition that involves multiple cases so that it looks nice with braces as one would write on paper. 
For example, the function $f(x)=|x|$ which is $f(x)=x$ if $x>0$ and $f(x)=-x$ if $x<0$.

First of all, I'd like to be able to write this out with braces in non-executable math in my worksheet. This would already be great.

Then, is it possible to actually define a function this way (ie, not just display the braces in non-executable, but actually run in executable math and have a defined function)?

Please Wait...