Use 'ifelse' statements instead of 'if' for validation