Interesting language

Cache’ Object Script is an interesting language. Take a look at the following two loops

test
	s done=0
	f ln=1:1:10 d  q:done
	. w !,ln
	. i ln=5 s done=1
	w !,"ln after loop "_ln
	q
test2
	s done=0
	f ln=1:1:10 q:done  d
	. w !,ln
	. i ln=5 s done=1
	w !,"ln after loop "_ln
	q

The goal is stop after five iterations and then use the ending index to do something more. Executing the above code results in…


PLAY>d test

1
2
3
4
5
ln after loop 5
PLAY>d test2

1
2
3
4
5
ln after loop 6
PLAY>

Can you spot the difference?

Comments

12:53 p.m. Sunday Dec. 14, 2008 (about 1 week after publishing)
Hmm ... Rehman Masood
The do is in different places .. Why does this post not show up on your homepage (thebitguru.com)? I saw it on the rss feed and came here via direct link but dont see it on the homepage.
2:08 p.m. Sunday Dec. 14, 2008 (about 1 week after publishing)
RE: Hmm ... Rehman Masood
actually it does. I didnt realize this was an old post.
Add new comment