Main loop refuses to identify Repeat?

BlitzMax Forums/BlitzMax Beginners Area/Main loop refuses to identify Repeat?

Hey Omni. Not sure if you care about this anymore, but I thought I'd give my input.
I think you had troubles for three reasons:

1. You used a loop embedded within a loop, with both using KEY_Y and KEY_N. So
because you used Key_Down instead of key_hit, your program flow becomes uncontrollable.

2. You have too many nested loops. Check out my code to see what I changed there.

3. Your indentation system is wonky, sorry man. That's likely why you missed the 'Endif'.
I really had to think in order to follow your code. No biggie, though.

AppTitle = "More like TEST adventure"
Graphics 400,300,0,60
Local font:TImageFont=LoadImageFont("C:\WINDOWS\Fonts\arial.ttf",16)
SetImageFont(font)

Repeat
	DrawText "How do you respond?  1 or 2", 100, 140
	DrawText "Hit e to exit", 100, 160
	Flip;cls
	If KeyHit(KEY_1) Then
		Repeat
			DrawText "YOU LOSE!", 100, 140
			DrawText "Play again? Y/N", 100, 160
			Flip;Cls
			If KeyHit(KEY_N) End
		Until KeyHit(KEY_Y)
	ElseIf KeyHit(KEY_2) Then
		Repeat
			SetColor Rnd(255), Rnd(255), Rnd(255)
			DrawText "YOU WIN!", 100, 140
			SetColor 255, 255, 255
			DrawText "Play again? (Y/N)", 100, 160
			Flip;Cls
			If KeyHit(KEY_N) End
		Until KeyHit(KEY_Y)
	EndIf
Until KeyDown(KEY_E)


I completely changed the structure so that it's simpler and easier to follow. I hope you get something from this.