Recently I've been thinking a lot about this, mostly from my own experience, and some from reading about it from others.
Getting stuck learning programming almost seems like writer's block for (you guessed it) writers. It's as if literally someone made a wall appear in front of you, and you walked into it face-first.
I've spent a lot of time over the last few years with my face in that wall, trying to find my way past it. Obviously I'm not expert, but these are the things I did that helped me break past that stuck barrier while learning to code. Keep in mind I'm a newbie programmer, maybe old school guys have some better techniques.
The obvious one, take a break. Go do something else for a bit. Clear your mind.
Try to break the problem down into the tiniest pieces. That helps me when I'm doing a programming challenges. It's possible it is just not small enough.
If you've tried everything else from searching for a solution, to asking questions on your given platform and you're still maybe not getting it, or feeling like it's just to difficult for you, try changing learning material. Everyone learns differently.
It is possible that maybe the instructor didn't explain it well enough, or you get the concept but are having trouble applying it. It's possible you just need more practice. Grab a book, or watch a youtube video. Make sure whatever you do, you type a LOT of code. Type everything out, even if you understand it mentally.
Anyway, that's just my take. What are some other things that might help someone get past a block?