Latex does not offer if/else, but Tex offer the ability to have conditional if/else statements, Here is a small snippet how to use it.

\documentclass[a4paper,11pt]{article}

\def \UserName {Devnodes}

\begin{document}

\ifx\UserName\undefined
	\textcolor{red}{Unknown User}
\else
	\UserName
\fi

\end{document}