When asking an interview candidate to write a program on the whiteboard, do you expect the candidate to write code that is syntactically correct?

I had two candidates, one of which wrote a syntactically correct program but the logic was not up to the mark, and the other had the logic better written but the syntax was crap. 

I favor the first candidate.

I would favor the person who was able to reason through the problem, come up with a good solution, and then explain their solution to me. Even if their logic wasn't 100%, if they were on the right track and were reasoning through the problem, asking the right questions, and going down the right path, that would be my winner.

When you are developing code on the job, you have many tools - IDEs, compilers, static analysis, unit tests, integration test, and acceptance test procedures - to find mistakes in syntax and logic. If you're writing on a white board, you don't have these tools and you're bound to make mistakes in syntax (forgetting a method name, a semicolon, a brace), and I can forgive that.

My only question to you: Why are you having your candidates write actual code on the whiteboard, instead of focusing on algorithms, design strategies, and logical thinking? Programming languages change, problem solving doesn't.
