+ 2

What would be the code for If I want the output '"print'"?

I tried this print (' '"print"' ')

20th Feb 2018, 2:00 AM
gulab singh
gulab singh - avatar
8 Answers
20th Feb 2018, 2:12 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
Do a backslash before the “ like this: print(‘\”print\”’)
20th Feb 2018, 2:07 AM
Jax
Jax - avatar
+ 2
I want "'print"' this output. There are two single quotes and two double quotes
20th Feb 2018, 2:13 AM
gulab singh
gulab singh - avatar
+ 2
Just put a backslash before every quote you wish to appear in the print.
20th Feb 2018, 2:14 AM
Jax
Jax - avatar
+ 2
this works. Thank you Jax
20th Feb 2018, 2:16 AM
gulab singh
gulab singh - avatar
+ 2
@Jax is correct. If you're using single quotes to encapsulate a string, you need to use the escape character '\' for every single quote that is part of the string.
20th Feb 2018, 2:17 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
0
Who downvoted me? It works. Try it out yourself if you don’t believe me.
20th Feb 2018, 2:11 AM
Jax
Jax - avatar
0
You are very welcome. 😉
20th Feb 2018, 2:17 AM
Jax
Jax - avatar