play as long as you have hope.
in a losing situation, should I resign? or keep playing till checkmate

what should I do in a losing situation? resign? or keep playing until I lose?
Play as long as you feel that there is still something to learn by continuing. As soon as you can clearly see how YOU would force a win if the sides were reversed, then it's OK to resign.
Lost games are valuable for what they teach us. As soon as you've learned all that lost game can teach, you are free to end it and start another (or even better, end it and then look it over to determine why you lost it).
what should I do in a losing situation? resign? or keep playing until I lose?