Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solidity undefined

I have a question when I use solidity to compile a simple contract. It like that:

> 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

I don't know why the result is "undefined", what is wrong? I'm using it on the mac os.

like image 545
wait_lin Avatar asked Feb 06 '17 06:02

wait_lin


People also ask

Does solidity have null?

Solidity programming language doesn't have the nullability feature, which is common in many languages like Swift and JavaScript. Instead, types have the default values, like zero 0 for uint .

What is an integer in solidity?

Integers help in storing numbers in contracts. Solidity provides the following two types of integer: Signed integers: Signed integers can hold both negative and positive values. Unsigned integers: Unsigned integers can hold only positive values along with zero.

Can private variables be inherited in solidity?

private variables / members are not inherited.

What is the default value of an address variable?

variable_name − This is the name of variable given by user. value − Any value to initialize the variable. By default, it is zero.


1 Answers

According to Greeter variables are all undefined and contract doesn't run undefined in JavaScript isn't a bad thing. Variable declarations always return undefined, its nothing to worry about.

So to answer your question, nothing is wrong, just proceed with your compiled clientContract and ignore the undefined return message.

like image 142
Afr Avatar answered Oct 15 '22 16:10

Afr