Essentially, by doing so you tell the javascript engine that the \ is not denoting a symbol to realize that the \ isn't actually waiting for something like "\n". Alternatively, you could use the special characters ampersand format for a slash: "\".
Very interested in computers, I like to solve mathematically involved problems through programming. Breaking down problems logically and finding clever solutions to show an extensive understanding of computers engages me.
Thursday, June 17, 2010
Programming Tip: Be Care With Quote Syntax
The other day, I was writing a program. It has to display a "\". So obviously, my first instinct was to write that. What I did not remember was that a slash there usually is waiting for some letter to come after it to denote a return or something similar. So, it was taking a quote as that letter. However, a ' " \" ' doesn't actually mean anything so the debugger was getting stuck there. So when you want to write a back slash, you have to click it twice.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment