Updated to match standard style conventions.
This commit is contained in:
parent
01ef6e4198
commit
88e209132e
@ -1,4 +1,4 @@
|
|||||||
^title IO Class
|
^title io Class
|
||||||
^category core
|
^category core
|
||||||
|
|
||||||
The IO class can be used to read and write to and from the console.
|
The IO class can be used to read and write to and from the console.
|
||||||
@ -6,7 +6,10 @@ The IO class can be used to read and write to and from the console.
|
|||||||
## Static Methods
|
## Static Methods
|
||||||
|
|
||||||
### IO.print(obj[, obj2, obj3...])
|
### IO.print(obj[, obj2, obj3...])
|
||||||
Prints any number of things to the console and then prints a new line character. If you don't pass it a string, it will be converted to a string for you. When passed multiple things, Wren outputs one after another.
|
|
||||||
|
Prints any number of things to the console and then prints a newline
|
||||||
|
character. If you don't pass it a string, it will be converted to a string for
|
||||||
|
you. When passed multiple things, Wren outputs one after another.
|
||||||
|
|
||||||
|
|
||||||
> IO.print("I like bananas")
|
> IO.print("I like bananas")
|
||||||
@ -16,15 +19,22 @@ Prints any number of things to the console and then prints a new line character.
|
|||||||
>
|
>
|
||||||
|
|
||||||
### IO.write(obj)
|
### IO.write(obj)
|
||||||
Prints a single thing to the console, but does not print a new line character afterwards. If you pass it something that isn't a string, it will convert it to a string.
|
|
||||||
|
Prints a single thing to the console, but does not print a newline character
|
||||||
|
afterwards. If you pass it something that isn't a string, it will convert it to
|
||||||
|
a string.
|
||||||
|
|
||||||
> IO.write(4+5)
|
> IO.write(4+5)
|
||||||
9>
|
9>
|
||||||
|
|
||||||
In the above example, the result of `4+5` is printed, and then the prompt is printed on the same line because no new line character was printed afterwards.
|
In the above example, the result of `4+5` is printed, and then the prompt is
|
||||||
|
printed on the same line because no newline character was printed afterwards.
|
||||||
|
|
||||||
### IO.read(prompt)
|
### IO.read(prompt)
|
||||||
Reads in and returns a line of text from the console. Takes a single string to be used as a prompt. Pass an empty string for no prompt. Note that the returned line of text includes the new line character at the end.
|
|
||||||
|
Reads in and returns a line of text from the console. Takes a single string to
|
||||||
|
be used as a prompt. Pass an empty string for no prompt. Note that the returned
|
||||||
|
line of text includes the newline character at the end.
|
||||||
|
|
||||||
> var name = IO.read("Enter your name: ")
|
> var name = IO.read("Enter your name: ")
|
||||||
Enter your name: John
|
Enter your name: John
|
||||||
|
|||||||
@ -20,6 +20,6 @@ All Wren source files automatically have access to the following classes:
|
|||||||
* [Range](range.html)
|
* [Range](range.html)
|
||||||
* [Sequence](sequence.html)
|
* [Sequence](sequence.html)
|
||||||
* [String](string.html)
|
* [String](string.html)
|
||||||
* [IO](IO.html)
|
* [IO](io.html)
|
||||||
|
|
||||||
[embedding]: ../embedding-api.html
|
[embedding]: ../embedding-api.html
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
<li><a href="range.html">Range</a></li>
|
<li><a href="range.html">Range</a></li>
|
||||||
<li><a href="sequence.html">Sequence</a></li>
|
<li><a href="sequence.html">Sequence</a></li>
|
||||||
<li><a href="string.html">String</a></li>
|
<li><a href="string.html">String</a></li>
|
||||||
<li><a href="IO.html">IO</a></li>
|
<li><a href="io.html">IO</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user