LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Printing quotations

Root / FAQs / [.]

SaladFingersCreated:
I'm trying to insert a print command into another program via a variable (it doesn't matter if this makes sense) and I'm wondering if there is a way to print a quotation. I know in Visual Basic you can just put a \ in and it'll ignore the quotation mark but is there a way in SB?

Yes, there is, in the keyboard menu. Some of the vets know fancier methods tho.

Yes, there is a way. Just use CHR$ to get that character. See the code below:
VAR Q$=CHR$(34)
? Q$+"HELLO WORLD"+Q$

I have used this just because it doesn't require you to store the value in a variable:
DEF Q()
 RETURN CHR$(34)
END
It can be used like:
PRINT Q()+"HELLO WORLD"+Q()

Speed test results (MS per 1,000,000):
      "”" 1878 (doesn't work as a " in code)
       Q$ 1918
 CHR$(34) 2683
KEY(3)[4] 2888 (don't use this lol)
      Q() 3862
Test code:
C=MILLISEC
FOR I=1 TO 1000000
 S$="thing to test"*1
NEXT
?MILLISEC-C
This isn't really important though, since even the slowest one only takes 0.000004 seconds (PRINT takes around 0.0004).

Thanks so much every one, I just had created a variable to store my quotation, thanks for the help!