Humans are very bad on whiteboard interviews. I like giving people a laptop better now
If a more advanced question is posed, then the assumption is that the requirement is for the prospective employee to accomplish even more advanced tasks in practice.
I see no value in the "gotcha" of you made a logic mistake since we all make them and there's a reason why we test code
I wrote if (n % 15) print "fizzbuzz" ...
I got away with it because my interviewer assumed it was some kind of shell which means 0 is true
I should have written n % 15 == 0 to be absolutely clear what I'm doing
note that in Rust this won't even compile:
3 | if n % 15 {
| ^^^^^^ expected `bool`, found integer
But I don't have the type checker to find mistakes for me when writing on a whiteboard which is not realistic. I can't commit this code because CI wouldn't merge a build failure anywayI don't think I've ever interviewed anyone like this, so far?
The comment is bit too bizarre to puzzle out.