macOS AppleScript example: Display clipboard contents in a dialog

AppleScript clipboard FAQ: Can you demonstrate an AppleScript clipboard example, such as displaying the macOS clipboard contents in an AppleScript dialog?

One of the crazy things about AppleScript is how easy it is to get the contents of the clipboard, and then display them in a dialog. Here's an AppleScript clipboard dialog example that does just that:

display dialog (the clipboard)

Yep, that’s it, just one line of text. Put this AppleScript code in your own ScriptEditor and run it, and you'll see it display the clipboard contents.

Okay, it doesn’t work so well when there are graphics in the clipboard, but it works just fine with text. I think that's very cool for one line of text.