I have trouble understanding why, when I try to calculate $ int_ {0} ^ { pi} | sin (x) | $ dx of its indefinite completeness I seem to get the wrong result of $ 0.

Of course $ | sin (x) | = sin (x) $ sure $ (0, pi) $ so I know that the result should be $ 2 $. But considering the indefinite integral

$ int | sin (x) | = – cos (x) sgn ( sin (x)) $

($ sgn is the function of the sign) I use fallacious reasoning to conclude that

$ int_ {0} ^ { pi} | sin (x) | dx = (- cos (x) sgn ( sin (x))) _ {0} ^ { pi} = – (- 1) (0) – (- 1) (0)) = 0 $

I think the problem is how do I use the signaling function, but as far as I know $ sgn ( sin (0)) = sgn ( sin ( pi)) = $ 0 and $ | sin (x) | $ is continuous on $ (0, pi) $. What am I doing wrong here?