0

I'm looking through the SAFEMOON contract here: https://bscscan.com/address/0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3#code

On line 835, the following notation is used:

(uint256 rAmount,,,,,) = _getValues(tAmount);

I'm wondering what the additional commas after rAmount mean. My intention is to understand this code so I can understand the smart contract. Any help is deeply appreciated.

Thanks.

2

If you have a look at the function signature of that function, it's function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256). It returns 6 values, so you could get the return values with something like (uint256 a, b, c, d, e, f) = _getValues(tAmount);.

If, however, you are not interested in all of the return values, you can simply assign them to "empty" slot. So if you only want to assign the first return variable, and not assign the rest of the return values anywhere, you can use (uint256 rAmount,,,,,) = _getValues(tAmount);

1
  • Brilliant. That makes sense! Thanks :)
    – zero_cool
    Jul 3 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.