# For loop within itemize + arrays of strings

Consider a document in which there are a few sections containing lists. The content is predictable; the list is preceded by a tiny preamble. Something like this:

\documentclass{article}%

% BASIC QUALIFICATIONS

\def\qualificationa{A degree}%
\def\qualificationb{Skill}%
\def\qualificationc{Common sense}%
%\def\qualificationd{Enthusiasm}%

\begin{document}

% duties
\section*{Basic Qualifications}

The successful candidate will have the following basic qualifications:

\begin{itemize}
\item{\qualificationa}%
\item{\qualificationb}%
\item{\qualificationc}%
%\item{\qualificationd}%
\end{itemize}

\end{document}


This mwe is inefficient and kind of useless for obvious reasons: (1) the use of definitions does not reduce the size or complexity of the code (2) one has to manage the a, b, etc. suffixes.

The following pseudocode would address both of these points

\documentclass{article}%

% BASIC QUALIFICATIONS

% define an array called \qualifications which has the elements:
% A degree
% Skill
% Common sense
% Enthusiasm

\begin{document}

% duties
\section*{Basic Qualifications}

The successful candidate will have the following basic qualifications:

\begin{itemize}
% for all elements in the array, wrap the value of the array element at index defined by the for loop counter with \item{ and }
\end{itemize}

\end{document}


Such list processing capabilities are provided by etoolbox:

\documentclass{article}

\usepackage{etoolbox}

% BASIC QUALIFICATIONS

\begin{document}

% duties
\section*{Basic Qualifications}

The successful candidate will have the following basic qualifications:

\begin{itemize}
\forlistloop{\item}{\qualifications}
\end{itemize}

\end{document}

• Grateful for this suggestion. This solution solves each of the issues identified in the original question. – John Chris May 26 '20 at 6:25