0

I found that in version 8, we explicitly use the keyword fallback for fallback function and there is a receive function also. Consider the following code:

receive() external payable {
...
}
fallback() external {
...
}

I have some questions:

1.The documentation at:link of version 8 documentation says that do not include white space in the receive and fallback functions.Kindly explain.

2.Can we use both receive() and fallback() functions for sending and receiving ether?

Somebody please guide me.

Zulfi.

2
  • 1
    Hey! check this answer and this answer for your 2nd question. In most cases, you will only need to implement receive. Dec 1, 2021 at 10:35
  • 1
    For the first question it means that there should be no spaces between the function name and the parenthesis: receive() <-- good, receive () <-- bad.
    – Ismael
    Dec 3, 2021 at 5:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.