Receive function in Solidity

--

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 {}

--

--

Solidity Programming Language
Solidity Programming Language

Written by Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps

No responses yet