...
/Format Specifiers: Formatted Element Output
Format Specifiers: Formatted Element Output
This lesson explores the formatted element output part of the format specifiers.
We'll cover the following...
Formatted element output #
Format specifiers between %( and %)
are applied to every element of a container (e.g. an array or a range):
Press + to interact
import std.stdio;void main() {auto numbers = [ 1, 2, 3, 4 ];writefln("%(%s%)", numbers);}
The format string above consists of three parts:
-
%(
: start of element format -
%s
: format for each element -
%)
: end of element ...