you can't castle while you're in check
Castle out of check, legal?

- Your king can NOT be in check- Though castling often looks like an appealing escape, you can’t castle while you are in check! Once you are out of check, then you can castle. Unlike moving, being checked does not remove the ability to castle later.

If any square that the king has to move through, including his own, is attacked, castling is illegal. The rook can be attacked, but not the king nor any of the squares that it has to move through.

Rules says more or less something like:
1.You can't castle if are in check.
2. You can't castle if squares where rook and king will be are under threat.

If any square that the king has to move through, including his own, is attacked, castling is illegal. The rook can be attacked, but not the king nor any of the squares that it has to move through.
I suspect this might have been the confusion that people had regarding this question.

FIDE rule 3.8b (2): Castling is prevented temporarily: [a] IF THE SQUARE ON WHICH THE KING STANDS, or the square which it must cross, or the square which it is to occupy, is attacked by one or more of the opponent's pieces

Rules says more or less something like:
1.You can't castle if are in check.
2. You can't castle if squares where rook and king will be are under threat.
Actually the rook might be attacked, for example, in the diagram below, castling is Legal for black

@Mr-Mudd doesn't know the basics of chess, thinking that you can "castle" whilst in check.
or they were joking...

I got a laugh out the last one "that explains why his rating is so low."
I've been away from Chess for decades, spare a game here and there (every other year or five) with someone who says they know the rules, which turns out to mean, they know how the pieces move. After a few months of 19, I found Chess.com last year. I played a few games and won a dozen or so from the starting gate of 400. Some of that old knowledge is still in there. Got close to 1000 and started to loose, so I've taken some time to watch YouTube videos and hope I've learned enough to go above 1000 and stay there!
Thanks for all the comments. Some have been amazing. See you on my favorite time control 15/10 = just enough time to think a bit.
I know that I can't castle into check or through check, but I'm confused. If neither of those things apply, and I am in check, is it allowed to castle OUT of check? I'm getting conflicting advice on this. Thanks in advance.