Math Piecewise style, which one is correct/best? I am writing my Computer Science Master Thesis. I am wondering what is the correct or in your opinion best looking style for piecewises:

See examples below:


Do I use a comma at the end of each line (ex last line)? 
Do I end the last line with a dot? 
Do I use a separator, and if yes which (in this example a colon) to seperate condition and formula?
What other things are stylewise wrong in the example below?


$$f(x) = \left\{
     \begin{array}{lr}
       0 &amp; : x \leq 0, \\
       1 &amp; : x &gt; 0. 
     \end{array}
   \right.$$
I use

$$f(x)=\begin{cases}0, &amp; \text{if $x&lt;0$;} \\ 
    1, &amp; \text{if $x\geq 0$.}\end{cases}$$


resulting in

$$f(x)=\begin{cases}0, &amp; \text{if $x&lt;0$;} \\ 
1, &amp; \text{if $x\geq 0$.}\end{cases}$$

IIRC this was also suggested by the authors of AMSmath.
Best practice is to ask your master's thesis supervisor if your Computer Science department has a required/recommended LaTeX style/class file that you should/could use for writing up your master's thesis as a whole (and that's not just for piecewise definitions of functions).  If said file is not available, ask your CS department for the thesis layout guidelines, if there are any.