I am looking to define a command (actually, an environment, but that shouldn't matter for the purposes of this question) that does some default behavior, and if an optional argument is passed, does something else.
For example,
\newcommand{mycommand}[1]{%
if (#1 != NULL){%
The argument #1 was passed}
else {%
No argument was passed.}}
Obviously this is not valid LaTeX, but hopefully this makes it clear what I am trying to do. Is there a way to do this with ordinary LaTeX? Is it worth switching to LuaLaTeX to accomplish behavior like this?