Skip to main content
4 of 6
Add explanation

Zig, 63 66 47 bytes

fn a()void{for(" "**'e')|_,i|{p("{d} ",.{i});}}

Try it online!

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 nothing
  • for () |_, i| For every item in the array inside of (), iterate and capture the entree as _ (a throwaway variable) and the index as i
  • " " ** '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.