1 [h1]
EN: Values
JA: 値

2 [p]
EN: Values are the built-in atomic object types that all other objects are composed
of. They can be created through literals, expressions that evaluate to a
value. All values are immutable—once created, they do not change. The
number 3 is always the number 3. The string "frozen" can never have its
character array modified in place.
JA: 値は、ほかのすべてのオブジェクトの構成要素となる、組み込みの基本的なオブジェクト型です。値を評価結果として得る式であるリテラルを使って作成できます。すべての値は不変で、一度作成すると変わりません。数値3は常に数値3です。文字列"frozen"の文字配列を、その場で変更することはできません。

3 [h2]
EN: Booleans #
JA: 真偽値 #

4 [p]
EN: A boolean value represents truth or falsehood. There are two boolean literals,
true and false. Their class is Bool.
JA: 真偽値は真または偽を表します。真偽値リテラルはtrueとfalseの二つです。そのクラスはBoolです。

5 [h2]
EN: Numbers #
JA: 数値 #

6 [p]
EN: Like other scripting languages, Wren has a single numeric type:
double-precision floating point. Number literals look like you expect coming
from other languages:
JA: ほかのスクリプト言語と同じように、Wrenの数値型は倍精度浮動小数点数の一種類です。数値リテラルは、ほかの言語を使ってきた人が予想するような形をしています。

UNCHANGED CODE 1

0
1234
-5678
3.14159
1.0
-12.34
0.0314159e02
0.0314159e+02
314.159e-02
0xcaffe2


7 [p]
EN: Numbers are instances of the Num class.
JA: 数値はNumクラスのインスタンスです。

8 [h2]
EN: Strings #
JA: 文字列 #

9 [p]
EN: A string is an array of bytes. Typically, they store characters encoded in
UTF-8, but you can put any byte values in there, even zero or invalid UTF-8
sequences. (You might have some trouble printing the latter to your terminal,
though.)
JA: 文字列はバイトの配列です。通常はUTF-8で符号化した文字を保存しますが、ゼロや不正なUTF-8列を含め、どんなバイト値でも入れられます。（ただし、後者を端末に表示するのは難しいかもしれません。）

10 [p]
EN: String literals are surrounded in double quotes:
JA: 文字列リテラルは二重引用符で囲みます。

UNCHANGED CODE 2

"hi there"


11 [p]
EN: They can also span multiple lines:
JA: 複数行にまたがることもできます。

UNCHANGED CODE 3

"hi
there,
again"


12 [h3]
EN: Escaping #
JA: エスケープ #

13 [p]
EN: A handful of escape characters are supported:
JA: いくつかのエスケープ文字をサポートしています。

UNCHANGED CODE 4

"\0" // The NUL byte: 0.
"\"" // A double quote character.
"\\" // A backslash.
"\%" // A percent sign.
"\a" // Alarm beep. (Who uses this?)
"\b" // Backspace.
"\e" // ESC character.
"\f" // Formfeed.
"\n" // Newline.
"\r" // Carriage return.
"\t" // Tab.
"\v" // Vertical tab.


"\x48"        // Unencoded byte     (2 hex digits)
"\u0041"      // Unicode code point (4 hex digits)
"\U0001F64A"  // Unicode code point (8 hex digits)


14 [p]
EN: A \x followed by two hex digits specifies a single unencoded byte:
JA: \xに続けて16進数の数字を二桁書くと、文字の符号化を行わず、単一のバイトを指定できます。

UNCHANGED CODE 5

System.print("\x48\x69\x2e") //> Hi.


15 [p]
EN: A \u followed by four hex digits can be used to specify a Unicode code point:
JA: \uに続けて16進数の数字を四桁書くと、Unicodeコードポイントを指定できます。

UNCHANGED CODE 6

System.print("\u0041\u0b83\u00DE") //> AஃÞ


16 [p]
EN: A capital \U followed by eight hex digits allows Unicode code points outside
of the basic multilingual plane, like all-important emoji:
JA: 大文字の\Uに続けて16進数の数字を八桁書くと、欠かせない絵文字など、基本多言語面の外にあるUnicodeコードポイントを指定できます。

UNCHANGED CODE 7

System.print("\U0001F64A\U0001F680") //> 🙊🚀


17 [p]
EN: Strings are instances of class String.
JA: 文字列はStringクラスのインスタンスです。

18 [h3]
EN: Interpolation #
JA: 文字列補間 #

19 [p]
EN: String literals also allow interpolation. If you have a percent sign (%)
followed by a parenthesized expression, the expression is evaluated. The
resulting object’s toString method is called and the result is inserted in the
string:
JA: 文字列リテラルでは補間も使えます。パーセント記号（%）の後に丸括弧で囲んだ式を書くと、その式が評価されます。結果のオブジェクトのtoStringメソッドを呼び出し、その結果を文字列に挿入します。

UNCHANGED CODE 8

System.print("Math %(3 + 4 * 5) is fun!") //> Math 23 is fun!


20 [p]
EN: Arbitrarily complex expressions are allowed inside the parentheses:
JA: 丸括弧の中には、どれほど複雑な式でも書けます。

UNCHANGED CODE 9

System.print("wow %((1..3).map {|n| n * n}.join())") //> wow 149


21 [p]
EN: An interpolated expression can even contain a string literal which in turn has
its own nested interpolations, but doing that gets unreadable pretty quickly.
JA: 補間する式には、さらに独自の補間を入れ子にした文字列リテラルを含めることもできます。ただし、そうするとすぐに読みにくくなります。

22 [h3]
EN: Raw strings #
JA: raw文字列 #

23 [p]
EN: A string literal can also be created using triple quotes """ which is
parsed as a raw string. A raw string is no different
from any other string, it’s just parsed in a different way.
JA: 三重引用符"""を使って文字列リテラルを作ることもでき、この場合はraw文字列として解析します。raw文字列も、ほかの文字列と違いはありません。解析の仕方が違うだけです。

24 [p]
EN: Raw strings do not process escapes and do not apply any interpolation.
JA: raw文字列ではエスケープを処理せず、補間も一切行いません。

UNCHANGED CODE 10

"""hi there"""


25 [p]
EN: When a raw string spans multiple lines and a triple quote is on it’s own line,
any whitespace on that line will be ignored. This means the opening and closing
lines are not counted as part of the string when the triple quotes are separate lines,
as long as they only contain whitespace (spaces + tabs).
JA: raw文字列が複数行にまたがり、三重引用符がそれだけの行にある場合、その行の空白は無視します。つまり、三重引用符を別の行に置き、それ以外が空白（スペースとタブ）だけなら、開始行と終了行は文字列の一部として数えません。

UNCHANGED CODE 11

  """
    Hello world
  """


26 [p]
EN: The resulting value in the string above has no newlines or trailing whitespace. 
Note the spaces in front of the Hello are preserved. 
JA: 上の例で得られる文字列の値には、改行も末尾の空白もありません。Helloの前にあるスペースは保持される点に注意してください。

UNCHANGED CODE 12

    Hello world


27 [p]
EN: A raw string will be parsed exactly as is in the file, unmodified.
This means it can contain quotes, invalid syntax, other data formats 
and so on without being modified by Wren.
JA: raw文字列は、ファイルに書かれたとおりに、変更せず解析します。つまり、引用符、不正な構文、ほかのデータ形式などを含めても、Wrenによって変更されません。

UNCHANGED CODE 13

"""
  {
    "hello": "wren",
    "from" : "json"
  }
"""


28 [p]
EN: One more example, embedding wren code inside a string safely.
JA: もう一つの例として、文字列にWrenのコードを安全に埋め込みます。

UNCHANGED CODE 14

"""
A markdown string with embedded wren code example.

    class Example {
      construct code() {
        //
      }
    }
"""


29 [h2]
EN: Ranges #
JA: 範囲 #

30 [p]
EN: A range is a little object that represents a consecutive range of numbers. They
don’t have their own dedicated literal syntax. Instead, the number class
implements the .. and ... operators to create them:
JA: 範囲は、連続する数値の範囲を表す小さなオブジェクトです。専用のリテラル構文はありません。代わりに、数値クラスが範囲を作る..と...の演算子を実装しています。

UNCHANGED CODE 15

3..8


31 [p]
EN: This creates a range from three to eight, including eight itself. If you want a
half-inclusive range, use ...:
JA: これで、8そのものも含む3から8までの範囲を作成します。片側の端点だけを含む範囲にしたい場合は、...を使います。

UNCHANGED CODE 16

4...6


32 [p]
EN: This creates a range from four to six not including six itself. Ranges are
commonly used for iterating over a
sequences of numbers, but are useful in other places too. You can pass them to
a list’s subscript operator to return a subset of the list, for
example, or on a String, the substring in that range:
JA: これは、6そのものを含まない4から6までの範囲を作成します。範囲は、数値の列を反復処理する際によく使いますが、ほかにも用途があります。例えば、リストの添字演算子に渡すとリストの一部分を、Stringに渡すとその範囲の部分文字列を返します。

UNCHANGED CODE 17

var list = ["a", "b", "c", "d", "e"]
var slice = list[1..3]
System.print(slice) //> [b, c, d]

var string = "hello wren"
var wren = string[-4..-1]
System.print(wren) //> wren


33 [p]
EN: Their class is Range.
JA: そのクラスはRangeです。

34 [h2]
EN: Null #
JA: Null #

35 [p]
EN: Wren has a special value null, which is the only instance of the class
Null. (Note the difference in case.) It functions a bit like void in some
languages: it indicates the absence of a value. If you call a method that
doesn’t return anything and get its returned value, you get null back.
JA: Wrenには特別な値nullがあり、これはNullクラスの唯一のインスタンスです。（大文字と小文字の違いに注意してください。）一部の言語のvoidに似た働きをし、値がないことを表します。何も返さないメソッドを呼び出して戻り値を取得すると、nullが返ります。

36 [p]
EN: 
Lists →
← Syntax
JA: リスト →← 構文
