I need to use If inside of a Table loop, e.g. Table[If[i< 3, i], {i, 5}] will give {1, 2, Null, Null, Null}
But I want the result to be {1,2}.
Any fix for this?
EDIT:
What if we consider Table[If[i< 3, f[i]], {i, 5}] which gives {f[1], f[2], Null, Null, Null}
Concisely:
This works because the function
## &does not immediately evaluate.## &is a “vanishing” function.See SlotSequence for more information.