Question: Plotting with mod

How do I write plot ceil(x) mod 2 properly?

If I write: 

plot(ceil(x) mod 2, x = 0 .. 4)

it produces a step pattern and not a square wave. (Only 0 and 1 should be plotted.) 

Please Wait...