Undefined variable error in Julia: UndefVarError:castnot defined

Please read this topic:

In particular, format your code properly.