I want to create a simple function that prints all prime numbers from 1 to x. I have the following code, which doesn't cause any errors from the kernel but it doesn't return anything:
allprimes[x_] = For[i=0, i<=x, i++,
If[PrimeQ[i], Print[i]]]
What have I done wrong?