Depending on the ordering of arrow draw commands, an arrowtip disappears

Minimum working example:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning}

\begin{document}
\begin{tikzpicture}
\draw
node[draw](A){A}
node[draw,right=of A](S){S}
node[draw,right=of A,above=of S](B){B};

\draw[->]
(A) |- (B)
(S) -- +(0,-1) -| (A);
\end{tikzpicture}
\end{document}

The nodes are positioned exactly as I desire. But the arrowtip for the arrow from A to B is missing.

I also noticed that when I move the command for drawing the arrow from S to A above the one for A to B, then instead the arrowtip for the arrow from S to A disappears.

Why does this happen? How do I fix it?

I hope to have understood your problem. There are two different codes with the same image.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning}

\begin{document}
\begin{tikzpicture}
\draw
node[draw](A){A}
node[draw,right=of A](S){S}
node[draw,right=of A,above=of S](B){B};
\draw[->] (A)|- (B);
\draw[->](S) -- +(0,-1) -| (A);
\end{tikzpicture}
\end{document}

The problem is that it is missing \draw[->]. You can compare also your code with my two codes.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning}

\begin{document}
\begin{tikzpicture}
\draw
node[draw](A){A}
node[draw,right=of A](S){S}
node[draw,right=of A,above=of S](B){B};

\draw[->]
(A) |- (B);
\draw[->](S) -- +(0,-1) -| (A);
\end{tikzpicture}
\end{document}
• I hope I have helped you well. :-) I edited my answer. Both codes have the same arrow. Mar 3, 2018 at 11:27