Strings

Strings represent text. A string may contain any characters from the Unicode character set.

A string may be delimited by using either double quotes " or single quotes '. These notations are equivalent except for the need to escape the delimiter used inside the strings.

Yewslip> print "Hello, world!"
Hello, world!

Yewslip> print "string" + 3
string3

Yewslip> print '-bang-' * 3
-bang--bang--bang-

Yewslip> print 'textlist' / 2
text

Yewslip> print -"loop."
.pool

Another way to specify strings that only contain characters which are allowed in variable names is to preceed it with a single backtick `.

Yewslip> print `key_1
key_1

Character combinations beginning with a backslash \ may be used in strings in place of characters that may not appear literally in the program source. These combinations are:

\\ \ (backslash)
\" " (double-quote)
\' ' (single quote)
\n newline (same as \15)
\r carriage return (same as \12)
\t tab (same as \9)
\octal-code character with given code, for characters \0-\377
\xhex-code character with given code, for characters \x0-\xff
\uhex-code character with given code, for characters \u0-\uffff
\Uhex-code character with given code, for characters \U0-\Uffffffff

Program source files and program output are always encoded in UTF-8. Any of "\n", "\r\n" and "\r" are interpreted as end-of-lines.

Note

Although Unicode characters range from \0 to \U7fffffff, strings may include any characters up to \Uffffffff. The UTF-8 encoding which is used for input and output by Yewslip is accordingly expanded to accomodate such characters.