Integration of functions involving If statements

I am having trouble with Integrating functions that involve If statements.
For example, I can integrate
If [Cos[-y] Sin Sin < 0, -1, 1]
with x over the range -pi to pi and y over the range 0 to pi

However, trying to integrate
If[(Cos[-y] Sin Sin + Cos) < 0, -1, 1]
over the same ranges fails with Mathematica just returning the entered integration command.

Is there any way to have Mathematica integrate functions containing If statements of this nature?
Thanks in anticipation.

Correction
Cos[-y] Sin Sin should be
Cos[-y] Sin Sin

and Cos[-y] Sin Sin + Cos should beCos[-y] Sin Sin + Cos

If statements are good for programming, but you don’t want to define mathematicals functions with it.

Instead, try using Piecewise: http://reference.wolfram.com/mathematica/ref/Piecewise.html
I also find using HeavisideTheta and UnitStep to be useful sometimes: http://reference.wolfram.com/mathematica/ref/HeavisideTheta.html

If statements are meant for control flow in a program and aren’t meant to be symbolicaly manipulatable parts of the definition of a Mathematical function.

Hi Roger,

It is not clear from your posts what are the integrant functions. Is the first one

If[Cos[-y] Sin[x]^2 < 0, -1, 1]

or

If[Cos[-y] Sin[Sin[x]] < 0, -1, 1] 

Is the second one

If[(Cos[-y] Sin[x] Sin[x] + Cos[x]) < 0, -1, 1]

If[Cos[-y] Sin^2 < 0, -1, 1]
is the first one.
If[(Cos[-y] Sin Sin + Cos) < 0, -1, 1]
is the second one.

Sorry for the confusion.

Thanks very much for your response Sean.

Could you please expand on this:
“If statements” “aren’t meant to be symbolicaly manipulatable parts of the definition of a Mathematical function.”

I think I get into problems with this quite a lot so it would help me to understand better, distinctions with respect to “symbolicaly manipulatable parts”.

I’m not sure I am able to clarify this with words very effectively beyond that statement.

If statements are meant for programming. They are meant to help define a program.

They aren’t meant to be used as a mathematical formalism in the definition of a function. The symbolic mathematical functions in Mathematica don’t handle if statements because If statements aren’t meant to be used in the definition of a mathematica formula. If statements are meant to be used in the definition of a program.

Thanks Sean