当我使用solidity来编译一个简单的合约时,我有一个问题。是这样的:
> web3.eth.getCompilers()
["Solidity"]
> source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
"contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
> source
"contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
> clientContract = eth.compile.solidity(source).test
undefined
Run Code Online (Sandbox Code Playgroud)
我不知道为什么结果是“未定义”,有什么问题?我在 mac os 上使用它。
根据Greeter 的 说法,变量都是未定义的,合约不在undefined
JavaScript 中运行并不是一件坏事。变量声明总是 return undefined
,没什么好担心的。
因此,要回答您的问题,没有错,只需继续编译clientContract
并忽略undefined
返回消息。
归档时间: |
|
查看次数: |
1197 次 |
最近记录: |