Can anyone explain this syntax?

I saw this in some solidity code but don’t get what it is exactly:

(bool success, ) ="");
require(success, "Transfer failed.");

what’s confusing me is the “(bool success, )” part.

It doesn’t look like the syntax of a variable and it doesn’t look like the syntax of a function. I get generally what it is being used FOR, but I don’t get why it is written that way or what you would even call this expression exactly.

1 Like

Hey @CryptoEatsTheWorld sorry for the late answer, I missed this one :slight_smile:

You can ignore an ‘x’ number of returned values by using commas.

    function a() public view returns (uint,bool,uint) {
        return (3,false,3);
    function b() public view {
        (uint number,,) = a();

You can declare the variables that will hold the returned values between ().

    function b() public view{
        (uint number,bool boolValue,uint number2 ) = a();

Let me know if you have questions,

Interesting. So the parentheses on the left are catching the variables from the function on the right.

Is this called anything in particular? it’s just syntax I don’t see described anywhere.