[Tex/LaTex] How to turn a draw edge twice

drawedgetikz-pgf

I want to connect two nodes with one edge so that it bends twice.

For instance,

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}

        \node  (A) {A};
        \node  (B) [below of=A] {B};

        \draw[->] (A.east) -- (B.east);


    \end{tikzpicture}

\end{document}

will connect the two nodes with a straight line, but I want something like this

wiw

For this I would draw using -|- as a parameter to \draw, but that doesn't compile.

How can I get that line with two straight bends?

Best Answer

One way to achieve that is to draw a straight line from A.east towards right of the lenght you need (for example to +(2em, 0)) and then a corner (|-) to B.east.

Please also look at Difference between "right of=" and "right=of" in PGF/TikZ.

\documentclass[border=4pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
    \begin{tikzpicture}
        \node  (A) {A};
        \node  (B) [below=3ex of A] {B};
        \draw[->] (A.east) -- +(2em, 0) |- (B.east);
    \end{tikzpicture}
\end{document}

enter image description here