Skip to content

Lesson-9: Need a code explanation #1891

Answered by krakxn
Vanshika0901 asked this question in Q&A
Discussion options

You must be logged in to vote

The above answer is partially wrong, and as so I will dissect—for concision—it in parts.

(bool success, ) stores the value of either true or false, depending on what the right-hand side to the = operator evaluates to.

recentWinner.call this results in the call keyword being used. Put simply, think of it as a "transferring money" keyword. So, we are transferring money to recentWinner's address, not "some address".

call{value: totalContractBalance} call takes in a value, which specifies the above quantity of the "money"

("") this is just a message, as to which we do not assign any, i.e an empty string. Hence, no message. BTW, this is used in advanced demonstrations usually.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@Vanshika0901
Comment options

@adityabhattad2021
Comment options

@Vanshika0901
Comment options

@adityabhattad2021
Comment options

@krakxn
Comment options

Answer selected by Vanshika0901
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