Receive function in Solidity
Mar 30, 2022
Aim: to understand fallback and receive functions in solidity
1- You can sent the ether without using any function!
contract Test {
receive() external payable {
}
}
We have 100 ether!
We try to sent 10 ether to the contract. We write 10 to the “Value” and click the Transact button.
We have sent 10 ether and we have 89 ether.
Note: You can also use this function
fallback() payable external {}