# How to write commands for cases? [duplicate]

For writing cases like a definition of a function having two or more conditions compiled by large braces ({), do I have to use and \begin{cases} within, or there is some other command which can be used even inside $$...$$ ?