TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: TIM HUTZLER
from: ANTON MONROE
date: 1996-07-12 06:25:00
subject: FOR/NEXT no work with ??

TH> ==============================
TH> FOR x?? = 10 to 1 STEP -1
TH>     ? x??
TH> NEXT
TH> ==============================
That example should give you an Error 6-- Overflow.  If it is being
ignored, it sounds like you have the numeric error checking turned off.
In the IDE it is under the top menu, Options/Compiler/Error Tests.
It isn't the Word data type per se that is the problem in a FOR/NEXT
loop, it's combining it with STEP -1.  You can demonstrate that with
   FOR x?? = 1 to 10 STEP 1
       ? x??
   NEXT
I think I recall that PB uses the data type of the variable to hold the
STEP amount.  So it errors out when it tries to assign a negative value
to a word.  Makes sense, I suppose; it's probably more efficient than
trying to subtract an integer from a word.
 * RM 1.31 1209 * Anton Monroe   70304.3663@compuserve.com
--- FidoPCB v1.4 [ff013/c]
---------------
* Origin: Sound Advice - 24 Nodes (816)436-4516 (1:280/333)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.