We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › print("\"); print("\\");
Page Index Toggle Pages: 1
print("\"); print("\\"); (Read 446 times)
print("\"); print("\\");
Jun 17th, 2007, 11:46am
 
I noticed that print("\"); doesn't work,
but print("\\"); will print "\"

Why ?
the "\" must stand for something else,
but I don't see it in the references.
Re: print("\"); print("\\");
Reply #1 - Jun 17th, 2007, 1:15pm
 
Backslash \ is the Escape_character.
http://en.wikipedia.org/wiki/Escape_character

http://www.codecodex.com/wiki/index.php?title=Escape_sequences_and_escape_characters#Java

println(""error"");

Re: print("\"); print("\\");
Reply #2 - Jun 17th, 2007, 1:15pm
 
To be able to use the character " or ' within itself, you must "escape" that character. That is done with a single slash.
i.e print("\""); prints a single ", as print('\''); will output '

print("seltar said: \"Hey man, this is a quote\", and you thought \"cool\"");
Re: print("\"); print("\\");
Reply #3 - Jun 17th, 2007, 8:50pm
 
Thanks for the answers,
that explains everything.

"I'm bored, therefore I program"
is better than
"I program, therefore I'm bored"
Page Index Toggle Pages: 1