 |
to GO
setCNT 0
forever [TEST]
end
to TEST
setCNT CNT + 1
if CNT > 10000
[print "END stopme]
end |
無限にカウントします。
止めるのは、stopme(これを止める)です。 |
 |
to GO
setCNT 0
TEST 0
end
to TEST :i
print :i
if :i > 10000
[print "END stop]
TEST :i + 1
end |
再帰処理でも
無限にカウントします。
止めるのは、 stop(止まる)です。 |

 |
to GO
setCNT 0
TEST 0
end
to TEST :i
print :i
if :i > 10000
[print "END stop]
TEST :i + 1
print "DUMMY
end |
再帰する次の行があると、
メモリがいっぱいになります。 |
|
to GO
setCNT 0
carefully[TEST 0]
[print "ERR]
end
to TEST :i
print :i
if :i > 10000
[print "END stop]
TEST :i + 1
print "DUMMY
end |
「メモリがいっぱい」は、
carefully(注意してやる)でトラップできますが、リサイクルでは解放できません。 |