How to Delete downloadable sample by id for Download product Magento 2?

Delete downloadable sample by sample id for the product Magento 2.

Each Downloadable Item supports the sample data of the attachment type like video, music, ebook, software file.

You can programmatically delete it by the sample id using code snippet with the delete($id) method.

Call from the template or any PHP class,

On Error of function call,
No downloadable sample with the provided ID was found. Verify the ID and try again.

Output:
true/false