PS1='%n%m %~ %(?..[%?] )%# '
It's a conditional expression. The part before the 1st dot is the expression; the part between the two dots is output if it's TRUE (or 0); the part after the second dot is output if it's FALSE (or any number but 0).
See my full customization on .zshrc file.