Interchanging single and double quotes

Looking at this page:

I see an example using double quotes followed by another example using single quotes. I ran a test on the later and both single and double quotes worked fine.

  1. Are there places where you can only use one or the other?
  2. Is there a “best practices” to use one over the other.

Thanks.

Either should be fine as both represent a String.