For x=0 to 255
Print chr$(x) ;
Gosub LineLen
Next x
end
LineLen:
for y=1 to 25
If y<25 then Return
If y=25 then Print chr$(13)
next y
Yikes! This code isn't doing things you want it to do!
On the first iteration, you are entering the "For X" loop. Then, you are doing a GOSUB, and entering a "For Y" loop. This is all valid. You have a nested "For...Next loop". What goes wrong is that you are then issuing a RETURN statement before your "Next Y" statement. Essentially, if you remove the GOSUB here, you'll see the problem.
For x=0 to 255
Print chr$(x) ;
for y=1 to 25
If y<25 then Next x
If y=25 then Print chr$(13)
next y
end
It's not valid to nest loops in the style of
For X
For Y
Next X
Next Y
The reason being that you will initialize multiple instances of the For Y loop, without finishing them. In your case, 255 For Y loops will be started. This will blow the stack on your BASIC interpreter and either return an error, or cause a memory leak. Even if by some miracle your BASIC interpreter has enough stack to get by this problem, you'll run into a "Next without For" condition on the Next X once the For X loop has run past 255.
The other methods previous posters have typed are much cleaner. :-)