I have a little environment to enumerate question statements. Sometimes, I want the label to not be a number but some string instead. In that case, I do not want the counter to be incremented.
% question environment
\newcounter{QuestionCounter}
\stepcounter{QuestionCounter}
\newenvironment{question}[1][\arabic{QuestionCounter}] {
\vspace*{0.5\baselineskip}
\noindent\textbf{Question #1. }\ignorespaces
\ifdefstrequal{#1}{\value{QuestionCounter}}
{\stepcounter{QuestionCounter}}
{}}{}
The concerning if-statement here being,
\ifdefstrequal{#1}{\value{QuestionCounter}}
{\stepcounter{QuestionCounter}}
{}
How can I compare the value (expansion?) of the argument #1 and the value of the counter \value{QuestionCounter}? I have tried \ifdefstrequal{\value{#1}}{\value{QuestionCounter}} because I thought \ifdefstrequal first two arguments need to be macros.
Thanks!

\if\relax\detokenize{#1}\relaxchecks for a lack of optional argument? – scribe Sep 01 '20 at 17:42\detokenize{#1}returns nothing and the test\if\relax\relaxreturns true. Otherwise\detokenize{#1}will deliver something that cannot start with\relax, so the test\if\relax<something>returns false and the rest of the string disappears as part of the “true text”. – egreg Sep 01 '20 at 17:47