proverb

Hang a thief when he is young, and he he 'll no' steal when he is old

wrongdoing

suggests that

A harsh punishment for a young offender might stop him or her from doing later a crime.