Solidity - 第一个应用
我们使用Remix IDE来编译和运行我们的Solidity代码库。< /p>
步骤 1 − 将给定的代码复制到 Remix IDE 代码部分。
示例
pragma solidity ^0.5.0;
contract SolidityTest {
constructor() public{
}
function getResult() public view returns(uint){
uint a = 1;
uint b = 2;
uint result = a + b;
return result;
}
}
步骤 2 − 在"编译"选项卡下,单击开始编译按钮。
步骤 3 − 在"运行"选项卡下,单击部署按钮。
步骤 4 − 在"运行"选项卡下,在下拉列表中选择 SolidityTest at 0x...。
步骤 5 − 单击getResult按钮显示结果。
输出
0: uint256: 3