What if I want to add double quotes inside the string declaration. Escape Sequences allow us to add new line, double quotes, etc in the string itself. It is always declared using a .
set exampleString to "Nayan is \"Awesome\"" display dialog exampleString
Explanation: In output we will have Nayan is "Awesome"
Figure 5.5.1 Escape Sequence Output
set exampleString2 to "Nayan is Awesome" display dialog exampleString2
Explanation: In output we will have Nayan is Awesome. There will be tab space between is and Awesome as \t signifies tab space.
Figure 5.5.2 Adding Tab Space
Another thing to note is that if you add an escape sequence and then compile the program, the escape sequence will get converted to what it actually means.
e.g. \t will get converted to (tab space)
Figure 5.5.2-2 Compiled Program with Escape Sequence
Other Escape Sequences include \n for new line, \? for question mar, \’ for single quotes, etc.
display dialog "Nayan \\\" Seth"
Explanation: In output we will have a dialog. The dialog will print Nayan \" Seth. \ gets converted to \ and \" gets converted to "
Figure 5.5.3 Printing \ and "