Sending BNB from inside smart contracts with solidity

Hi developers :raised_back_of_hand:
I need to transfer BNB from inside my token contract with solidity,can any one help about that?

Hey, I think you can write a function to send BNB, just like

function sendBNB(address payable _to) public payable {
    (bool sent, bytes memory data) ={value: msg.value}("");
    require(sent, "Failed to send BNB");

Notice, you should add permission to this function.

I used your code and got this error:

Pazooki/1.sol:219:46: ParserError: Expected ';' but got '{'
(bool sent, bytes memory data) ={value: msg.value}("");
Any idea?

This is only an example, maybe it is not suitable for your contract, I mean you can use