Zig, 63 66 47 bytes
fn a()void{for(" "**'e')|_,i|{p("{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("{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.