Drawing concentric circles with alternating colors by means of \foreach in TikZ

You mean something like this:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[mystyle/.style={circle,draw,fill=none,minimum size=20, line width = 8pt}]
  \foreach \x in {1,3,5,7,9,11,13,15,17,19}
\node [mystyle,  minimum size = \x cm, color =red!70]  (2) at (0, 0) {};
  \foreach \x in {2,4,6,8,10,12,14,16,18, 20}
\node [mystyle,  minimum size = \x cm, color =yellow!50]  (2) at (0, 0) {};
\end{tikzpicture}
\end{document}  

which would give you:

enter image description here

I just made the yellow a bit lighter because, it was bleeding yellow too much :D


A slight generalization of Raaja's and TeXncian's answers in that I allow arbitrary color cycle lists, which is illustrated by an additional list of length 3.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\def\lstColors{{"red!70","yellow!50"}}
\foreach \X [evaluate=\X as \Col using {\lstColors[int(mod(\X,2))]}] in {1,...,20}
{\draw[line width = 8pt,\Col] (0,0) circle (\X);}
\end{tikzpicture}
\begin{tikzpicture}
\def\lstColors{{"red!70","yellow!50","blue!70"}}
\foreach \X [evaluate=\X as \Col using {\lstColors[int(mod(\X,3))]}] in {1,...,20}
{\draw[line width = 8pt,\Col] (0,0) circle (\X);}
\end{tikzpicture}
\end{document}

enter image description here


A PSTricks solution.

\documentclass[pstricks]{standalone}
\psset{runit=4pt,unit=\psrunit}
\begin{document}
\pspicture[linewidth=.5](-11,-11)(11,11)
    \foreach \i in {1,2,...,10}{%
        \ifodd\i\def\c{yellow}\else\def\c{red}\fi
        \pscircle[linecolor=\c]{\i}}
\endpspicture
\end{document}

enter image description here

Note: There is an unnecessary white spot after converting to PNG.

Animated version

\documentclass[pstricks]{standalone}
\psset{runit=4pt,unit=\psrunit}
\begin{document}    
\foreach \j in {1,...,10}{%
\pspicture[linewidth=.5](-11,-11)(11,11)
    \foreach \i in {1,...,\j}{%
        \ifodd\i\def\c{yellow}\else\def\c{red}\fi
        \pscircle[linecolor=\c]{\i}}%
\endpspicture}
\end{document}

enter image description here