Question: How to integral a procedure

I define a procedure function like this

f:=proc if 0<=x<1 then 1 else 0 fi; end proc

but when i want to integral it

int(f(x),x=0..2)

maple gave me the information like this

Error, (in g) cannot determine if this expression is true or false: 0 <= x and x < 1

I want to know why? and I know use piecewise function can solve this. but  I think is there any other method to solve it?

Please Wait...