Introduction
A constructor function sets up a new smart contract with initial values when it is created. It helps prepare the contract to work correctly from the start.
When you want to set the owner of a smart contract right away.
When you need to give initial values like token name or supply.
When you want to set important settings that should not change later.
When you want to make sure some data is ready before anyone uses the contract.