Unessary spinning

in a circle how can i tell what is the shortest path

if (team1[h].rot > cursorDegree - 90)
{
team1[h].rot = team1[h].rot - 20;
}
if (team1[h].rot < cursorDegree - 90)
{
team1[h].rot = team1[h].rot + 20;
}

this works unless the number jumps the 0/360 gap then it will require a full counter clockwise run im wondering what i need to add to this for a more intelligent rotating of a movieclip , thanks for your help :slight_smile: