Repeat a string: Difference between revisions

(Clarify Scratch a little)
Line 213:
=={{header|D}}==
Repeating a string:
<lang d>import std.stdio, std.string;
import std.string;
 
void main() {
writefln(repeat("ha", .repeat(5));
{
writefln(repeat("ha", 5));
}</lang>
Repeating a character with vector operations:
Line 224 ⟶ 222:
 
void main() {
char[]str chars; // create the dynamic array
strchars.length = 5; // set the length
strchars[] = '*'; // set all characters in the string to '*'
writefln(strchars);
}</lang>
 
Anonymous user