// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;contract Work {
uint salary; // Create a new work contract to initialize the salary
constructor() {
salary = 0;
} // Increase your salary once you work
function doWork() public {
salary += 1;
} // Pay salary
function pay() public view returns (uint) {
return salary;
}
}
說明
每條合約都還能夠細部說明,而單行則以//進行註記,多行則以///進行註記。
// This is a single-line comment. /// This is a
/// multi-line comment.