Strange behavior...

May 24, 2010
855
0
Northlake, Il
The following code works as expected:

For /L %IDX In (0,1,%TDX) Do (
@Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
)

The following code does not (at all!!!!! - it does exactly one iteration of the loop :confused:):

Set IDX=0
Do While %IDX LE %TDX
@Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
Set IDX=%Inc[%IDX]
EndDo

There are no other changes to the code other than what's shown here between working and not working. The reason I care is because I have other do-while loops in the code that also do not appear to work, and they really can't be turned into "for" loops because they are not "counted" loops. Please excuse my evident stupidty, but what is going on here????

TCC 10.00.67 Windows 7 [Version 6.1.7100]
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: mathewsdw
To: ESFabian@comcast.net
Sent: Saturday, 2010. October 30. 00:57
Subject: [Support-t-2387] Strange behavior...

| The following code works as expected:
|
| For /L %IDX In (0,1,%TDX) Do (
| @Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
| )
|
| The following code does not (at all!!!!! - it does exactly one
| iteration of the loop ):
|
| Set IDX=0
| Do While %IDX LE %TDX
| @Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
| Set IDX=%Inc[%IDX]
| EndDo
|
| There are no other changes to the code other than what's shown here
| between working and not working. The reason I care is because I have
| other do-while loops in the code that also do not appear to work, and
| they really can't be turned into "for" loops because they are not
| "counted" loops. Please excuse my evident stupidty, but what is going
| on here????
|
| TCC 10.00.67 Windows 7 [Version 6.1.7100]

Simple - your increment command is misspelled, the @ symbol is missing from the function name (penultimate line of 2nd code fragement). BTW, DO also cas a "counted" mode:

Do IDX = 0 to %TDX
@Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
EndDo
--
HTH, Steve
 
May 24, 2010
855
0
Northlake, Il
---- Original Message ----
From: mathewsdw
To: ESFabian@comcast.net
Sent: Saturday, 2010. October 30. 00:57
Subject: [Support-t-2387] Strange behavior...

| ...
|
| The following code does not (at all!!!!! - it does exactly one
| iteration of the loop ):
|
| Set IDX=0
| Do While %IDX LE %TDX
| @Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
| Set IDX=%Inc[%IDX]
| EndDo
|
| ...

Simple - your increment command is misspelled, the @ symbol is missing from the function name (penultimate line of 2nd code fragement). BTW, DO also cas a "counted" mode:

Do IDX = 0 to %TDX
@Echo %IDX %CmdLnths[%IDX] %CmdNames[%IDX]
EndDo
--
HTH, Steve

Steve, you are of course absolutely correct regarding your answer, but, unfortunately, I wasn't correct in writing my posting. I didn't copy and paste the code in question into my posting, I transcribed it and made a transcription error - i. e., my actual code does have the missing @ symbol, and no, it still doesn't work. But the other code in question does now work (I found my coding error(s)), and since this code with the "for" loop does work, I'm not going to waste any more of my (or your, for that matter) time on this matter since I now consider it to be a dead issue. I will also note (possibly again) that I am somewhat visually impaired (I have to do everything with either a very large font (18 pt. or greater) or the Windows "Magnifier" app), so I often miss "little" things of this nature - but that wasn't the case for the code in question. But thank you very much for your response!

- Dan
 
Similar threads
Thread starter Title Forum Replies Date
Jesse Heines Strange Line Wrapping Behavior Support 14
N Fixed Strange dir behavior Support 6
P Strange mouse behavior with list Support 2
D Strange DO behavior with /O Support 5
vefatica Strange behavior reloading SHRALIAS sav files. Support 1
S Strange CHKDSK behavior Support 6
R strange bug? Support 7
F strange results Support 9
M Strange error messages from TCC in FTP copy Support 7
M Another possibly strange remote registry issue Support 5
forbin Strange handling of [nonbright] magenta background (v22) Support 2
vefatica REGDIR, strange error message Support 7
T WAD Strange Unexpected "features" in the Debugger Support 2
vefatica Strange tcc.exception.log Support 7
vefatica A strange one Support 0
Glenn Bowes Strange text at startup Support 5
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
vefatica Big numbers, strange errors Support 1
aedthuio Strange... lpksetup Support 4
CWBillow dir /4 strange Support 2
D Strange issue with FOR loop Support 15
MikeBaas Strange prob with %@replace.. Support 4
vefatica OT: strange files in %TEMP Support 10
Dan Glynhampton Documentation v15 help: Strange links in @INT topic Support 0
R WAD Strange output from "memory" command Support 1
M Yet another strange something re something called "@TCONVERT" Support 8
Roedy How to? Strange colours Support 9
M WAD Strange "Start" misbehavior... Support 10
vefatica Very strange console font corruption Support 3
Steve Pitts Strange problem with FREE Support 10
A strange error in alias Support 9
newgeekorder Debugger IDE - strange tab and parameter behaviour Support 1
Exolon Strange Prompt. Support 6
vefatica Strange folders Support 1
T Strange CPU value Support 3
J Strange error: unset /s Support 14
CWBillow Strange happenings Support 2
B Strange handling of a .BAT file Support 5
J ASSOC / FTYPE strange error message Support 3
D Strange crashes in @CRC32 and @MD5 Support 9
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
vefatica Strange results with CP 1252 Support 12
S Strange REN problem - non-English characters Support 3
dcantor Strange status in ACTIVATE command Support 0
H @XMLNODES - New behavior? Support 3
H Behavior change re piping a string to a Java program Support 1
Jay Sage Baffling Behavior With TPIPE Support 5
D Pasting Unicode data has different behavior on TCC and CMD Support 2
P "Set" command behavior - a bug? Support 3
P LOG command behavior Support 3

Similar threads