7

Using a single \foreach loop with different uses in the coordinates is much easier:
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in{0,...,4}
{ \draw (0,\x ,4) -- (4,\x ,4);
\draw (\x ,0,4) -- (\x ,4...