Skip to content

Do I need to write return something??? #4606

Answered by Koowah
h0leee asked this question in Q&A
Discussion options

You must be logged in to vote

@h0leee

In that case, you gave the return variable names in the declaration, so there's no need for a return statement.

function foo() public pure returns (uint256) { return 5}
is equivalent to
function foo() public pure returns (uint256 x) { X = 5 }

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@h0leee
Comment options

Comment options

You must be logged in to vote
2 replies
@h0leee
Comment options

@Koowah
Comment options

Answer selected by alymurtazamemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants