2D Minecraft-Like Game, Rendering issue.

Hey guys :3

How do I render what’s only on the screen? I can currently only render an array of:

blocks[50][50], any higher and the game begins to lag. I’m guessing because I am looping through all of those tiles every frame and I need to know how to render much more but only what’s on the screen so it doesn’t lag… Any help?