AMPscript is a scripting language that you can embed within HTML emails, text emails, landing pages, SMS messages, and push notifications from MobilePush. The system processes the script at the point where you include it in the message to render content on a subscriber-by-subscriber basis. The Marketing Cloud application handles all AMPscript calls at the end of the email send.
AMPscript can also interact with your data extensions. Use AMPscript to include information from your data extensions in your messages and to update data extensions with information from your landing pages.
Use AMPscript to process information and include information from your data extensions in the body of your messages and landing pages to provide advanced personalization for the subscribers.
Check out official syntax guide on AMPscript by Salesforce below:-
Check out AMPscript Guide written by Eliot Harper and Adam Spriggs below:-