#6 Payable Functions in Solidity — Smartcontract — Ethereum

Payable functions provide a mechanism to collect / receive funds in ethers to your contract . Payable functions are annotated with payable keyword.

In the above example payme function is annotated with payable keyword, which translates to that you can send ethers to payme function.

Where are the ethers stored in payable functions?

All the ethers sent to payable functions are owned by contract. In the above example Sample contract owns all of the ethers.

Payable fallback functions :

A function without any name and annotated with payable keyword is called payable fallback function. There could be only one such function in contract.