Skip to content

Commit 93222f0

Browse files
authored
Merge pull request #5134 from JackStouffer/stdio-docs
Fix Issue 16991 - Make writeln documentation palatable merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents da3e83a + d7f6cc3 commit 93222f0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

std/stdio.d

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,15 +3374,32 @@ private @property File trustedStdout() @trusted
33743374
}
33753375

33763376
/***********************************
3377-
For each argument $(D arg) in $(D args), format the argument (as per
3378-
$(LINK2 std_conv.html, to!(string)(arg))) and write the resulting
3377+
For each argument $(D arg) in $(D args), format the argument (using
3378+
$(REF to, std,conv)) and write the resulting
33793379
string to $(D args[0]). A call without any arguments will fail to
33803380
compile.
33813381
33823382
Params:
33833383
args = the items to write to `stdout`
33843384
33853385
Throws: In case of an I/O error, throws an $(D StdioException).
3386+
3387+
Example:
3388+
Reads `stdin` and writes it to `stdout` with an argument
3389+
counter.
3390+
---
3391+
import std.stdio;
3392+
3393+
void main()
3394+
{
3395+
string line;
3396+
3397+
for (size_t count = 0; (line = readln) !is null; count++)
3398+
{
3399+
write("Input ", count, ": ", line, "\n");
3400+
}
3401+
}
3402+
---
33863403
*/
33873404
void write(T...)(T args) if (!is(T[0] : File))
33883405
{

0 commit comments

Comments
 (0)