Forte (Forter), 4525 bytes
1PUT5PRINT"ol";:LET5=1
1PUT76
Explanation
An undefined behavior exploit courtesy of Jo King:
1 PUT 76
Print an L
character.
5 PRINT "ol"; : LET 5 = 1
Print ol
without a final newline, and set 5 to 1.
Apparently, this overwrites the former line 1 with the former line 5, and thus (lacking an END
statement) the PRINT "ol";
line is executed repeatedly forever. But I don't really understand how this works--especially since it only works if you write line 5 before line 1, not vice versa...
Here's a 44-byte version that doesn't use any undefined behavior:
1PUT76
5PRINT"ol";:LET6=6+0
6LET0=2:LET5=5+2
Explanation
1 PUT 76
Print an L
character.
5 PRINT "ol"; : LET 6 = 6 + 0
Print ol
without a final newline, and set 6 to 6.
6 LET 0 = 2 : LET 5 = 5 + 2
Set 0 to 2, and set 5 to 7.
57 PRINT "ol"; : LET 6 = 6 +02
Print ol
again, and set 6 to 8.
68 LET02 = 2 : LET57 =57 + 2
Set 2 to 2, and set 7 to 9.
579 PRINT "ol"; : LET68 =68 +02
Print ol
again, and set 8 to 10.
And so on forever.