Writing Variable Values
If your syntax is fine and you are dealing with runtime errors, you can strip out all HTML in your email or web page leaving just your AMPscript. If that does not give you some direction, reduce your code to the least amount that works, then slowly add to it until it breaks. While this is repetitive, it can get you to the problem area quickly.
Sometimes, reducing to only AMPscript isn’t a reasonable approach. Another useful technique is to output variable values in the flow of your code: