Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
r := make([]int, n)
for i := range n {
r[i] = i
}
var
r: array of integer;
n, i: integer;
....
SetLength(r,n);
for i := 0 to n-1 do r[i] := i;
r = list(range(n))
r = (0...n).to_a
let r: Vec<i32> = (0..n).collect();