Skip to content

Commit 1951dec

Browse files
authored
Merge pull request #5133 from JackStouffer/stdio-docs
Added example to std.stdio.writeln
2 parents e95fabb + 3ca07de commit 1951dec

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

std/stdio.d

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,6 +3415,22 @@ void write(T...)(T args) if (!is(T[0] : File))
34153415
*
34163416
* Throws:
34173417
* In case of an I/O error, throws an $(LREF StdioException).
3418+
* Example:
3419+
* Reads $(D stdin) and writes it to $(D stdout) with a argument
3420+
* counter.
3421+
---
3422+
import std.stdio;
3423+
3424+
void main()
3425+
{
3426+
string line;
3427+
3428+
for (size_t count = 0; (line = readln) !is null; count++)
3429+
{
3430+
writeln("Input ", count, ": ", line);
3431+
}
3432+
}
3433+
---
34183434
*/
34193435
void writeln(T...)(T args)
34203436
{

0 commit comments

Comments
 (0)