I read LaTeX \if condition and How to write if and then in algorithm?, but so far it did not ring a bell for me.
I am trying to create a command named dottedSkill like below. The logic behind it is:
- receive two parameters
- iterate over the counter x from 1 to #2
- if my counter filled is > 0, I draw a full dot and decrement the counter
- else I draw an empty dot
\newcommand{\dottedSkill}[2]{
%parameter 1 the filled dots
%parameter 2 the max dots
\newcounter{x}
\newcounter{filled}
\setcounter{filled}{#1}
\forloop{x}{1}{\value{x} <= #2}
{
\ifnum \filled<1
\Circle
\else
\CIRCLE
\addtocounter{filled}{-1}
\fi
}
}%
I am not sure if the problem is with the command definition or someplace else, but when I call it on my file I get:
- Undefined control sequence. \dottedSkill{2}{9}.
- Missing number, treated as zero. \dottedSkill{2}{9}
- Undefined control sequence. \dottedSkill{2}{9}.
- Missing number, treated as zero. \dottedSkill{2}{9}
Is my function properly written?



So I did that \newcommand{\EmptyDot}{\Circle} \newcommand{\FilledDot}{$\CIRCLE$}
\newcommand{\dottedSkill}[2]{% %parameter 1 the filled dots %parameter 2 the max dots
– Daniel Ferreira Castro Jan 06 '24 at 22:59\multido{\ix=1+1}{#1}{\FilledDot}% \ifnum#1<#2 \multido{\ix=#1+1}{\numexpr#2-#1}{\EmptyDot}\fi }%
\Circleand\CIRCLEare defined as, hence me taking some liberty to define something similar. – Werner Jan 07 '24 at 03:45