Completely different meaning. If ate a bar of chocolate in the library despite posted signs against eating and drinking. I broke a rule. If I threw my chocolate bar at the librarian's face with an intent to injure him, I broke a law (assault and injury etc.)