\documentclass{tikzposter}

%% uncomment for the article behaviour

% \documentclass{article}  % to compare normal behaviour
% \newcommand{\block}[2]{\section{#1}#2}
% \newenvironment{myblock}[1]{\section{#1}\begin{alltt}}{\end{alltt}}
% \usepackage{alltt}

\begin{document}

\block{Test alltt}{
\begin{alltt}
 a <- 1
 b <- 2  \# Line breaks should be preserved!
 c <- 3  \# Special characters like \# or \% should be ignored!
\end{alltt}
}

% \begin{myblock}{Test alltt}
%  a <- 1
%  b <- 2  # Line breaks should be preserved!
%  c <- 3  # Special characters like \# or \% should be ignored!
% \end{myblock}


\end{document}



%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
