Power Query M code
let
Doubles = List.Generate(
() => 1,
each _ < 100,
each _ * 2
)
in
Doubles
Builds a list by repeatedly applying a step, similar to a while loop in imperative languages.
let
Doubles = List.Generate(
() => 1,
each _ < 100,
each _ * 2
)
in
Doubles
The three functions are, in order: the initial value, the condition to keep going, and how to get the next value from the current one.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Iterate with List.Generate (Custom Loop).