[futurebasic] Re: [FB] Sudoku

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2006 : Group Archive : Group : All Groups

From: <gbeckman@...>
Date: Fri, 19 May 2006 10:54:38 -0400
Ron,

It is sort of frowned on by some, but you can also use a GOTO to move to skip a few steps.   Here is a small FN that uses this technique.

 
LOCAL
DIM counter,mytest
DIM Test%,StuID%

LOCAL FN TestForRCTEntries(TestNumber$)
'=======OK, we don't match on this slot so check all slots ====
myTest=0
StuID%=VAL(TestNumber$)
FOR Counter=1 TO _Max
test%=VAL(gRCTStudentID$(counter))
LONG IF StuID%=Test%
myTest=Counter
GOTO "jumpOut"'quick out
END IF
NEXT counter
"jumpOut"
END FN=myTest




> 
> From: Ronald Anderson <rjanderson@...>
> Date: 2006/05/18 Thu PM 12:40:42 EDT
> To: Future Basic Forum <futurebasic@...>
> Subject: [FB] Sudoku
> 
> How do I get a FOR Next loop to exit when there is a match between an 
> external variable and one in the loop?  After using my Sudoku program 
> for some time it is obvious that a nice feature would be to alert the 
> user when he entered a number in a cell that it was a duplicate of a 
> number already in either a column or row of that cell.
> 
> If I cant stop the loop, is there a way to prevent the results of a 
> match from being neutralized by the next step in which there is no 
> match?
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
> 

Best Wishes,

George
gbeckman@...
http://www.pggp.com