Theres a small mistake there in the first if statement, you use := wich is to assign, a c/c++ family == is the same as = without the :

Just my 2 pence.