While I was answering another question, I found the error
! Illegal unit of measure (pt inserted).
only when I use ... in a \foreach with a simple operation of the list length:
\documentclass{article}
\usepackage{tikz}
\usepackage{listofitems}
\setsepchar{;}
\begin{document}
\readlist\points{(1,2); (2,3); (3,2); (1,1); (2,2)}
This works:
\begin{tikzpicture}
\foreach \i in {1,2,3,4}
{\draw \points[\i] -- \points[\i+1];}
\end{tikzpicture}
This works:
\begin{tikzpicture}
\foreach \i in {1,...,4}
{\draw \points[\i] -- \points[\i+1];}
\end{tikzpicture}
This works:
\begin{tikzpicture}
\foreach \i in {1,2,3,\pointslen-1}
{\draw \points[\i] -- \points[\i+1];}
\end{tikzpicture}
This gives the error
\texttt{! Illegal unit of measure (pt inserted).}
\begin{tikzpicture}
\foreach \i in {1,...,\pointslen-1}
{\draw \points[\i] -- \points[\i+1];}
\end{tikzpicture}
\end{document}


listofitems, one gets the same error result with the syntax:\def\tmp{5} \begin{tikzpicture} \foreach \i in {1,...,\tmp-1} {\draw \points[\i] -- \points[\i+1];} \end{tikzpicture}– Steven B. Segletes Nov 06 '21 at 19:16listofitemstag. – CarLaTeX Nov 06 '21 at 19:17int(...)even with an evaluate but I didn't manage to solve the problem as you did. – CarLaTeX Nov 06 '21 at 19:19