# This just tests a load of the interpreters
# main functions.

var cnt cnt2 fred str1 str2 @arr flip
var i world_tpday

set fred 0
set cnt -1
set str2 "tom"
set flip 0

proc main

set cnt 0
do 
	if flip=0 
		set str1 "fred"
		set flip 1
	else
		set str1 "hmm"
		set flip 0
	endif

	choose str1
		value "fred"; printnl "GGGGOOOOOOOT  IIIIIITTTTTT";  break;
		value "hmm"; for i 1 to 3; printnl "HMMM..." i; next
		default; printnl "Didn't work"; 
	chosen

	set cnt [add cnt 1]
	printnl "Cnt is " cnt
	if cnt=7; set str2 "tom"; endif
	printnl str2

	set arr:"element" 0
	while arr:"element"<=4
		printnl "-- " arr:"element" " --" 
		set arr:"element" [add arr:"element" 1] 
	wend 

	printnl "Fred start "  fred
	for fred 1 to 10 
		printnl "Fred is " fred
		printnl "CALLING PROC2 WITH " fred
		call proc2 fred
		printnl "RESULT: " $proc:"proc2"
	next

until cnt=10 or str2!="tom" 

printnl "Cnt is " cnt
printnl "Str2 is " str2
printnl "End"
endproc


proc proc2 v1
printnl "IN PROC2"
for i v1 to 10 step 1 
	printnl "I is " i
next
return [addstr "hel" [addstr "lo " "there"]]
endproc

