Tips for creating polyglots A polyglot is a program that can be run in 2 or more different programming languages.

What general tips do you have for making polyglots, or choosing languages that are easy to write polyglots for a specific task?

Please post the tips that could be applied in most situations. I.e. they shouldn't work only in polyglots of two specific languages. (You could simply post an answer to a polyglot question if you have a too specific tip.) But you can introduce features of a language that makes it easy to work with many languages, or easy to be added to any existing polyglots.

Please post one tip per answer. And feel free to suggest edit if a language-specific tip also applies to another language.
Exploit comment symbols

A simple way to create a two-language polyglot is to have the code divided in two parts as follows:


The first part does the actual work in language A, is harmless in language B (no errors), and ends in a language-A comment symbol, which hides the second part to language A.
The second part does the actual work in language B.


Thus


Language A sees the first part, which does the job, and then a comment.
Language B sees a useless first part and then the second part, which does the job.


The only difficult part here is finding a set of statements (first part) that do the job in language A while not giving errors in language B. Some suggestions for this:


Most stack-based languages allow displaying only the top of the stack at the end of the program (sometimes this is even default, as in 05AB1E).
Some languages ignore undefined statements (for example Golfscript).


A simple example that uses these guidelines can be found here. Languages A and B are MATL and 05AB1E respectively.