Binary search: Difference between revisions

Content added Content deleted
m (→‎{{header|BASIC}}: Dots after messages.)
Line 1,505: Line 1,505:
IF IndX >= 0 THEN
IF IndX >= 0 THEN
PRINT " is at index ";
PRINT " is at index ";
PRINT IndX
PRINT IndX;
PRINT "."
ELSE
ELSE
PRINT " is not found"
PRINT " is not found."
ENDIF
ENDIF
RETURN
RETURN
Line 1,547: Line 1,548:
{{out}}
{{out}}
<pre>
<pre>
2 is at index 4
2 is at index 4.
5 is not found
5 is not found.
</pre>
</pre>


Line 1,642: Line 1,643:
200 PRINT X;
200 PRINT X;
210 IF I1 < 0 THEN 240
210 IF I1 < 0 THEN 240
220 PRINT "is at index"; I1
220 PRINT "is at index"; I1; "."
230 RETURN
230 RETURN
240 PRINT "is not found"
240 PRINT "is not found."
250 RETURN
250 RETURN