pragma solidity ^0.8.3;
contract ConstructorIntro {
address public owner;
uint public x;
constructor(uint _x) {
// Here the owner is set to the caller
owner = msg.sender;
x = _x;
}
}
Solidityconstructor
The code defines a constructor for a contract called "ConstructorIntro". The constructor takes an unsigned integer as an input, and sets the owner of the contract to the caller.
0 Comments
Add Comment
Log in to add a comment