[Tex/LaTex] Class options declaration error: Undefined control sequence

class-optionsdocumentclass-writing

I'm trying to write a class file with certain options (e.g centered title, vs title on the left). When I compile a *.tex file that calls this class, I get the an undefined control sequence error for \@centeredtrue:

! Undefined control sequence.
\ds@centered ->\@centeredtrue 

Below is my MWE class file; I drew on how to declare options from the article.cls file. I don't understand why I'm getting this error, when the article.cls class file has similar option declarations for its oneside and twoside options, but the article.cls file doesn't throw this error.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}[2014/02/18 v0.0.1 Example Class For Errors]

\DeclareOption{centered}{\@centeredtrue}
\DeclareOption{flank}{\@centeredfalse}
\ExecuteOptions{centered}
\ProcessOptions

\endinput

My intent is to run conditional code dictated by my class's option.

Best Answer

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}[2014/02/18 v0.0.1 Example Class For Errors]

\newif\if@centered  \@centeredfalse %%%%%%%%%%%%%%%%%%%%%  
\DeclareOption{centered}{\@centeredtrue}
\DeclareOption{flank}{\@centeredfalse}
\ExecuteOptions{centered}
\ProcessOptions

\endinput