I am trying to create a command `test` that takes 3 arguments. The first argument is optional, while the second and third arguments are mandatory.

I am trying to use the [`xifthen`](https://ctan.org/pkg/xifthen?lang=en) package, and specifically the `\xifthen` and `\isempty` commands therein, to test whether the optional argument is given.

* If the optional argument is NOT given, `test` should return "A".
* If the optional argument is given, `test` should return "B".

Here is my MWE:

```
\documentclass{article}
\usepackage{xifthen}

\newcommand{\test}[3]{%
\ifthenelse{\isempty{#1}}{A}{B}
}

\begin{document}

\test{u}{v}
\\
\test[something]{u}{v}

\end{document}

```

But I get the following output. What is/are my mistake(s)?

[![output](https://i.stack.imgur.com/Wbbgi.png)](https://i.stack.imgur.com/Wbbgi.png)