Zig, 63 66 4747 72 bytes
fn a()void{for(" "**'e')|_,i|{p@import("std").debug.print("{d} ",.{i});}}
I've excluded the @import()
boilerplate as it seems analogous to C's #include
, which is excluded from other answers. If deemed necessary, I will add it back in.
Explanation
const p = @import("std").debug.print; // Import the debugging print function
fn a() void {
for (" " ** 'e') |_, i| {
p@import("std").debug.print("{d} ",.{i});
}
}
fn a() void
Declare a function which takes no parameters and returns nothingfor () |_, i|
For every item in the array inside of()
, iterate and capture the entree as_
(a throwaway variable) and the index asi
" " ** 'e'
Take the string (strings are slices, or pointer-arrays which know their length) and repeat it'e'
(101) times**
Requires a little bit more more explanation I think: In Zig, there is the concept of "comptime" (compile time) and runtime.**
is an operator which repeats any array literal or slice literal at comptime, because the resulting length is still known to the compiler.p@import("std").debug.print("",.{});
Print to STDERR (I believe that's valid for this question, right?), the first argument is the formatting string, and the second is an "anonymous sctruct"/tuple with a variable number of arguments in it (Zig doesn't have var-args)."{d} "
The format string. Zig denotes{}
as the formatting characters, withd
meaning a digit in this case.