Warning and Punishment in the Torah
Is it always obligatory in the Torah to give a warning and then a punishment, or can there be a direct punishment and from this we understand that those who are being warned are also being warned? If not, why is it so important to warn and punish separately?