String Literal tilde ~
Monkey Forums/Monkey Bug Reports/String Literal tilde ~| 
 | ||
| Should this compile/work? Function Main()
    Print "~"
End | 
| 
 | ||
| I guess not. ~ looks like an escape character so you can do stuff like ~n for a line feed. To print ~ you should do IMO Print "~~" Haven't tested it though... ;) | 
| 
 | ||
| I think is should work as it is not scaping anything BUT the easiest way to find out is testing it yourself. | 
| 
 | ||
| @Ziggy - yep I have tested it and it does compile in Monkey, but I think it shouldnt (also in BlitzMax you get an error trying this). The Monkey docs states:  String literals are sequences of characters enclosed in "" (quotation marks). String literals may also include escape sequences - special sequences of characters used to represent unprintable characters. You can use the following escape sequences in string literals: Escape sequence Character code ~q 34 (quotate mark ") ~n 10 (newline) ~r 13 (return) ~t 9 (tab) ~z 0 (null> ~~ 126 (tilde ~) | 
| 
 | ||
| It looks wrong, or at least peculiar. Monkey considers the strings "~" and "~~" to be equal. | 
| 
 | ||
| That's what I would expected. I would only scape a ~ if I want to write this text: ~q or this text: ~n or anything that requires me to scape the ~ char. If I do not need to scape it, why should I be forced to? |