Our aim is that we want to print in the console like:
""Geeks" for "Geeks" is 'the' best 'platform'"
To print quotes, using escape characters we have two options:
- For single quotes: \’ (backslash followed by single quote)
- For double quotes: \” (backslash followed by double quotes)
We can print quotes in the console using single and double quotes also without using escape characters. But there is a restriction we can either print only single or double-quotes. If the string is represented in single quotes then we can print only double quotes, and if the string is represented as single quotes then we can print double quotes inside it. Strings represented in single or double quotes are the same, no difference.
true Geeks for Geeks Geeks for Geeks "Geeks" "FOR" Geeks 'Geeks' 'FOR' Geeks
Example 2: Using escape sequences – If you have begun the quotes using \’ then you must end the quote also using \’ and vice versa.
Geeks 'FOR' Geeks Geeks "FOR" Geeks 'Geeks "FOR" Geeks' ""Geeks" for "Geeks" is 'the' best 'platform'"