Comparing inside FOR loopHow to disable both `eol` and `delims` options of `for /F`?Comparing Strings in Batch inside a for (if statement))In cmd.exe, how can you get one variable to escape the setlocal command?average number of file lines from CMDCan't get last 2 characters in token, and for loop returns first token in a vaiableWhen I runned windows bat to rename a set of files by adding prefix which is longer than 2 chars,why the first file will be renamed twice?In Windows shell, How do I echo the date of the oldest file in a directory?Batch, Variable vanishes after being setBatch file that moves all movies to a specific folder file needs renamedClear variables values in batchReturn value of a function to a function in batch scriptvariable not getting assigned within windows 'for loop'
Confusion regarding control system of Mars Rover?
Garage door sticks on a bolt
Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?
Re-entering the UK after overstaying in 2008
What's the global, general word that stands for "center tone of a song"?
What is the meaning of first flight and introduction in aircraft production?
Can I pay some of the cost of an activated ability lots of times to get more out of the effect?
Everyone Gets a Window Seat
C++ Standard-Thread Threadpool
Convert a string of digits from words to an integer
Why does `FindFit` fail so badly in this simple case?
Why aren't faces sharp in my f/1.8 portraits even though I'm carefully using center-point autofocus?
How deep is the liquid in a half-full hemisphere?
Missing quartile in boxplot
Enlightenment finding me
QGIS: Add a field with geometry WKT
IEEE 754 square root with Newton-Raphson
Why most footers have a background color as a divider of section?
Disable all sound permanently
If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?
Can the President of the US limit First Amendment rights?
Looking for circuit board material that can be dissolved
How to have hashes doubled _and_ things expanded?
How can Germany increase investments in Russia while EU economic sanctions against Russia are still in place?
Comparing inside FOR loop
How to disable both `eol` and `delims` options of `for /F`?Comparing Strings in Batch inside a for (if statement))In cmd.exe, how can you get one variable to escape the setlocal command?average number of file lines from CMDCan't get last 2 characters in token, and for loop returns first token in a vaiableWhen I runned windows bat to rename a set of files by adding prefix which is longer than 2 chars,why the first file will be renamed twice?In Windows shell, How do I echo the date of the oldest file in a directory?Batch, Variable vanishes after being setBatch file that moves all movies to a specific folder file needs renamedClear variables values in batchReturn value of a function to a function in batch scriptvariable not getting assigned within windows 'for loop'
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm trying to read a list of values/strings (they vary between letters and numbers) from a text file, if the value/string exist in the an output text file do nothing, else append it to the text file.
I spent over 3 days doing research and trying all sort of things and ideas.
On my search I came across a post very similar (link below) to what i need to do but since i'm new to Programming and literally I have no one to ask for help, I'm hoping you guys can help me out.
Comparing Strings in Batch inside a for (if statement))
So used something very similar to the post above, but I don't know I'm just tired or I'm just blind to see where I'm doing things wrong.
@echo off
set ProjectNo=12345
set ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models
set location=X:Scripts
set areas=%location%%ProjectNo%-AREAS.txt
set MAT=%location%%ProjectNo%-MAT.txt
setlocal enableextensions enabledelayedexpansion
for /F %%a in ("%areas%") do (
set "MA=%%a"
setlocal EnableDelayedExpansion
echo(!MA!
pause
if exist "!MA!"=="!MA:%MA%=!" (
echo matched
> nul
) else (
echo nomatch
> %MAT%
)
endlocal
)
)
endlocal
pause
Content of 12345-AREAS.txt is as follow (current):
01
01
10
10
10
10
130
15
15
15
20
20
20
20
25
25
25
30
30
30
30
This list could vary from 10 - 300 values (varies a lot)
What i aim to obtain in the output file 12345-MAT.txt is single and unique value of each like so:
01
10
130
15
20
25
30
batch-file
add a comment
|
I'm trying to read a list of values/strings (they vary between letters and numbers) from a text file, if the value/string exist in the an output text file do nothing, else append it to the text file.
I spent over 3 days doing research and trying all sort of things and ideas.
On my search I came across a post very similar (link below) to what i need to do but since i'm new to Programming and literally I have no one to ask for help, I'm hoping you guys can help me out.
Comparing Strings in Batch inside a for (if statement))
So used something very similar to the post above, but I don't know I'm just tired or I'm just blind to see where I'm doing things wrong.
@echo off
set ProjectNo=12345
set ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models
set location=X:Scripts
set areas=%location%%ProjectNo%-AREAS.txt
set MAT=%location%%ProjectNo%-MAT.txt
setlocal enableextensions enabledelayedexpansion
for /F %%a in ("%areas%") do (
set "MA=%%a"
setlocal EnableDelayedExpansion
echo(!MA!
pause
if exist "!MA!"=="!MA:%MA%=!" (
echo matched
> nul
) else (
echo nomatch
> %MAT%
)
endlocal
)
)
endlocal
pause
Content of 12345-AREAS.txt is as follow (current):
01
01
10
10
10
10
130
15
15
15
20
20
20
20
25
25
25
30
30
30
30
This list could vary from 10 - 300 values (varies a lot)
What i aim to obtain in the output file 12345-MAT.txt is single and unique value of each like so:
01
10
130
15
20
25
30
batch-file
add a comment
|
I'm trying to read a list of values/strings (they vary between letters and numbers) from a text file, if the value/string exist in the an output text file do nothing, else append it to the text file.
I spent over 3 days doing research and trying all sort of things and ideas.
On my search I came across a post very similar (link below) to what i need to do but since i'm new to Programming and literally I have no one to ask for help, I'm hoping you guys can help me out.
Comparing Strings in Batch inside a for (if statement))
So used something very similar to the post above, but I don't know I'm just tired or I'm just blind to see where I'm doing things wrong.
@echo off
set ProjectNo=12345
set ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models
set location=X:Scripts
set areas=%location%%ProjectNo%-AREAS.txt
set MAT=%location%%ProjectNo%-MAT.txt
setlocal enableextensions enabledelayedexpansion
for /F %%a in ("%areas%") do (
set "MA=%%a"
setlocal EnableDelayedExpansion
echo(!MA!
pause
if exist "!MA!"=="!MA:%MA%=!" (
echo matched
> nul
) else (
echo nomatch
> %MAT%
)
endlocal
)
)
endlocal
pause
Content of 12345-AREAS.txt is as follow (current):
01
01
10
10
10
10
130
15
15
15
20
20
20
20
25
25
25
30
30
30
30
This list could vary from 10 - 300 values (varies a lot)
What i aim to obtain in the output file 12345-MAT.txt is single and unique value of each like so:
01
10
130
15
20
25
30
batch-file
I'm trying to read a list of values/strings (they vary between letters and numbers) from a text file, if the value/string exist in the an output text file do nothing, else append it to the text file.
I spent over 3 days doing research and trying all sort of things and ideas.
On my search I came across a post very similar (link below) to what i need to do but since i'm new to Programming and literally I have no one to ask for help, I'm hoping you guys can help me out.
Comparing Strings in Batch inside a for (if statement))
So used something very similar to the post above, but I don't know I'm just tired or I'm just blind to see where I'm doing things wrong.
@echo off
set ProjectNo=12345
set ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models
set location=X:Scripts
set areas=%location%%ProjectNo%-AREAS.txt
set MAT=%location%%ProjectNo%-MAT.txt
setlocal enableextensions enabledelayedexpansion
for /F %%a in ("%areas%") do (
set "MA=%%a"
setlocal EnableDelayedExpansion
echo(!MA!
pause
if exist "!MA!"=="!MA:%MA%=!" (
echo matched
> nul
) else (
echo nomatch
> %MAT%
)
endlocal
)
)
endlocal
pause
Content of 12345-AREAS.txt is as follow (current):
01
01
10
10
10
10
130
15
15
15
20
20
20
20
25
25
25
30
30
30
30
This list could vary from 10 - 300 values (varies a lot)
What i aim to obtain in the output file 12345-MAT.txt is single and unique value of each like so:
01
10
130
15
20
25
30
batch-file
batch-file
edited Mar 29 at 15:16
Enzo
asked Mar 28 at 20:15
EnzoEnzo
247 bronze badges
247 bronze badges
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
Here is a simple approach that sorts the text data, reads the text line by line, compares each line with the previous one and returns the current one only in case of mismatch:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Reset buffer for previous line:
set "PREV="
rem // Write to output file:
> "12345-MAT.txt" (
rem // Read lines from input file:
for /F delims^=^ eol^= %%L in ('sort "12345-AREAS.txt"') do (
rem // Store current line:
set "LINE=%%L"
rem // Toggle delayed expansion to not lose `!`-signs:
setlocal EnableDelayedExpansion
rem // Compare current line with previous one:
if not "!LINE!"=="!PREV!" echo(!LINE!
endlocal
rem // Store line for next loop iteration:
set "PREV=%%L"
)
)
endlocal
exit /B
The advantage of this method is that all characters may occur; the disadvantage might be the modest performance.
Thanks for the alternative! love it! Could you please explain me howfor /F delims ^=^ eol^=works, to my understanding you always have to quote mark delims.
– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually thefor /Foptions should be quoted; however, to disable bothdelims(defaults to space and tab) andeol(defaults to;) this special syntax is needed (^is the escape character incmdneeded here to not interpret space and=as token separator); see also this thread for this topic...
– aschipfl
Mar 29 at 15:45
add a comment
|
So you are after a sort unique.
Here a variant which doesn't need delayed expansion,
by setting env vars with the items enclosed in _[]
@echo off
set "ProjectNo=12345"
set "ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models"
set "location=X:Scripts"
set "areas=%location%%ProjectNo%-AREAS.txt"
set "MAT=%location%%ProjectNo%-MAT.txt"
Setlocal
:: clear env vars _[
for /f "delims=" %%A in ('set _[ 2^>Nul') Do set "%%A="
(for /f %%A in ('sort ^<"%areas%"') Do if not defined _[%%A] (
set "_[%%A]=1"
Echo:%%A
)
) > "%MAT%"
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
No, to assure no vars also begining with_[are present before processing. The trick is that although I'm setting a variable inside a (code block) theif definedwill check the actual state and not the state when first entering the block at parse time.
– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl theif definedasures no doublettes are output.
– LotPings
Apr 25 at 22:36
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406174%2fcomparing-inside-for-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a simple approach that sorts the text data, reads the text line by line, compares each line with the previous one and returns the current one only in case of mismatch:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Reset buffer for previous line:
set "PREV="
rem // Write to output file:
> "12345-MAT.txt" (
rem // Read lines from input file:
for /F delims^=^ eol^= %%L in ('sort "12345-AREAS.txt"') do (
rem // Store current line:
set "LINE=%%L"
rem // Toggle delayed expansion to not lose `!`-signs:
setlocal EnableDelayedExpansion
rem // Compare current line with previous one:
if not "!LINE!"=="!PREV!" echo(!LINE!
endlocal
rem // Store line for next loop iteration:
set "PREV=%%L"
)
)
endlocal
exit /B
The advantage of this method is that all characters may occur; the disadvantage might be the modest performance.
Thanks for the alternative! love it! Could you please explain me howfor /F delims ^=^ eol^=works, to my understanding you always have to quote mark delims.
– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually thefor /Foptions should be quoted; however, to disable bothdelims(defaults to space and tab) andeol(defaults to;) this special syntax is needed (^is the escape character incmdneeded here to not interpret space and=as token separator); see also this thread for this topic...
– aschipfl
Mar 29 at 15:45
add a comment
|
Here is a simple approach that sorts the text data, reads the text line by line, compares each line with the previous one and returns the current one only in case of mismatch:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Reset buffer for previous line:
set "PREV="
rem // Write to output file:
> "12345-MAT.txt" (
rem // Read lines from input file:
for /F delims^=^ eol^= %%L in ('sort "12345-AREAS.txt"') do (
rem // Store current line:
set "LINE=%%L"
rem // Toggle delayed expansion to not lose `!`-signs:
setlocal EnableDelayedExpansion
rem // Compare current line with previous one:
if not "!LINE!"=="!PREV!" echo(!LINE!
endlocal
rem // Store line for next loop iteration:
set "PREV=%%L"
)
)
endlocal
exit /B
The advantage of this method is that all characters may occur; the disadvantage might be the modest performance.
Thanks for the alternative! love it! Could you please explain me howfor /F delims ^=^ eol^=works, to my understanding you always have to quote mark delims.
– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually thefor /Foptions should be quoted; however, to disable bothdelims(defaults to space and tab) andeol(defaults to;) this special syntax is needed (^is the escape character incmdneeded here to not interpret space and=as token separator); see also this thread for this topic...
– aschipfl
Mar 29 at 15:45
add a comment
|
Here is a simple approach that sorts the text data, reads the text line by line, compares each line with the previous one and returns the current one only in case of mismatch:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Reset buffer for previous line:
set "PREV="
rem // Write to output file:
> "12345-MAT.txt" (
rem // Read lines from input file:
for /F delims^=^ eol^= %%L in ('sort "12345-AREAS.txt"') do (
rem // Store current line:
set "LINE=%%L"
rem // Toggle delayed expansion to not lose `!`-signs:
setlocal EnableDelayedExpansion
rem // Compare current line with previous one:
if not "!LINE!"=="!PREV!" echo(!LINE!
endlocal
rem // Store line for next loop iteration:
set "PREV=%%L"
)
)
endlocal
exit /B
The advantage of this method is that all characters may occur; the disadvantage might be the modest performance.
Here is a simple approach that sorts the text data, reads the text line by line, compares each line with the previous one and returns the current one only in case of mismatch:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Reset buffer for previous line:
set "PREV="
rem // Write to output file:
> "12345-MAT.txt" (
rem // Read lines from input file:
for /F delims^=^ eol^= %%L in ('sort "12345-AREAS.txt"') do (
rem // Store current line:
set "LINE=%%L"
rem // Toggle delayed expansion to not lose `!`-signs:
setlocal EnableDelayedExpansion
rem // Compare current line with previous one:
if not "!LINE!"=="!PREV!" echo(!LINE!
endlocal
rem // Store line for next loop iteration:
set "PREV=%%L"
)
)
endlocal
exit /B
The advantage of this method is that all characters may occur; the disadvantage might be the modest performance.
answered Mar 29 at 13:27
aschipflaschipfl
22k9 gold badges36 silver badges63 bronze badges
22k9 gold badges36 silver badges63 bronze badges
Thanks for the alternative! love it! Could you please explain me howfor /F delims ^=^ eol^=works, to my understanding you always have to quote mark delims.
– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually thefor /Foptions should be quoted; however, to disable bothdelims(defaults to space and tab) andeol(defaults to;) this special syntax is needed (^is the escape character incmdneeded here to not interpret space and=as token separator); see also this thread for this topic...
– aschipfl
Mar 29 at 15:45
add a comment
|
Thanks for the alternative! love it! Could you please explain me howfor /F delims ^=^ eol^=works, to my understanding you always have to quote mark delims.
– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually thefor /Foptions should be quoted; however, to disable bothdelims(defaults to space and tab) andeol(defaults to;) this special syntax is needed (^is the escape character incmdneeded here to not interpret space and=as token separator); see also this thread for this topic...
– aschipfl
Mar 29 at 15:45
Thanks for the alternative! love it! Could you please explain me how
for /F delims ^=^ eol^= works, to my understanding you always have to quote mark delims.– Enzo
Mar 29 at 15:11
Thanks for the alternative! love it! Could you please explain me how
for /F delims ^=^ eol^= works, to my understanding you always have to quote mark delims.– Enzo
Mar 29 at 15:11
You're welcome! Yes, usually the
for /F options should be quoted; however, to disable both delims (defaults to space and tab) and eol (defaults to ;) this special syntax is needed (^ is the escape character in cmd needed here to not interpret space and = as token separator); see also this thread for this topic...– aschipfl
Mar 29 at 15:45
You're welcome! Yes, usually the
for /F options should be quoted; however, to disable both delims (defaults to space and tab) and eol (defaults to ;) this special syntax is needed (^ is the escape character in cmd needed here to not interpret space and = as token separator); see also this thread for this topic...– aschipfl
Mar 29 at 15:45
add a comment
|
So you are after a sort unique.
Here a variant which doesn't need delayed expansion,
by setting env vars with the items enclosed in _[]
@echo off
set "ProjectNo=12345"
set "ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models"
set "location=X:Scripts"
set "areas=%location%%ProjectNo%-AREAS.txt"
set "MAT=%location%%ProjectNo%-MAT.txt"
Setlocal
:: clear env vars _[
for /f "delims=" %%A in ('set _[ 2^>Nul') Do set "%%A="
(for /f %%A in ('sort ^<"%areas%"') Do if not defined _[%%A] (
set "_[%%A]=1"
Echo:%%A
)
) > "%MAT%"
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
No, to assure no vars also begining with_[are present before processing. The trick is that although I'm setting a variable inside a (code block) theif definedwill check the actual state and not the state when first entering the block at parse time.
– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl theif definedasures no doublettes are output.
– LotPings
Apr 25 at 22:36
add a comment
|
So you are after a sort unique.
Here a variant which doesn't need delayed expansion,
by setting env vars with the items enclosed in _[]
@echo off
set "ProjectNo=12345"
set "ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models"
set "location=X:Scripts"
set "areas=%location%%ProjectNo%-AREAS.txt"
set "MAT=%location%%ProjectNo%-MAT.txt"
Setlocal
:: clear env vars _[
for /f "delims=" %%A in ('set _[ 2^>Nul') Do set "%%A="
(for /f %%A in ('sort ^<"%areas%"') Do if not defined _[%%A] (
set "_[%%A]=1"
Echo:%%A
)
) > "%MAT%"
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
No, to assure no vars also begining with_[are present before processing. The trick is that although I'm setting a variable inside a (code block) theif definedwill check the actual state and not the state when first entering the block at parse time.
– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl theif definedasures no doublettes are output.
– LotPings
Apr 25 at 22:36
add a comment
|
So you are after a sort unique.
Here a variant which doesn't need delayed expansion,
by setting env vars with the items enclosed in _[]
@echo off
set "ProjectNo=12345"
set "ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models"
set "location=X:Scripts"
set "areas=%location%%ProjectNo%-AREAS.txt"
set "MAT=%location%%ProjectNo%-MAT.txt"
Setlocal
:: clear env vars _[
for /f "delims=" %%A in ('set _[ 2^>Nul') Do set "%%A="
(for /f %%A in ('sort ^<"%areas%"') Do if not defined _[%%A] (
set "_[%%A]=1"
Echo:%%A
)
) > "%MAT%"
So you are after a sort unique.
Here a variant which doesn't need delayed expansion,
by setting env vars with the items enclosed in _[]
@echo off
set "ProjectNo=12345"
set "ProjectLocation=X:Projects123 ABC45 WALLG Drafting 123452 Models"
set "location=X:Scripts"
set "areas=%location%%ProjectNo%-AREAS.txt"
set "MAT=%location%%ProjectNo%-MAT.txt"
Setlocal
:: clear env vars _[
for /f "delims=" %%A in ('set _[ 2^>Nul') Do set "%%A="
(for /f %%A in ('sort ^<"%areas%"') Do if not defined _[%%A] (
set "_[%%A]=1"
Echo:%%A
)
) > "%MAT%"
edited Mar 28 at 21:09
answered Mar 28 at 20:58
LotPingsLotPings
24.3k6 gold badges17 silver badges33 bronze badges
24.3k6 gold badges17 silver badges33 bronze badges
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
No, to assure no vars also begining with_[are present before processing. The trick is that although I'm setting a variable inside a (code block) theif definedwill check the actual state and not the state when first entering the block at parse time.
– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl theif definedasures no doublettes are output.
– LotPings
Apr 25 at 22:36
add a comment
|
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
No, to assure no vars also begining with_[are present before processing. The trick is that although I'm setting a variable inside a (code block) theif definedwill check the actual state and not the state when first entering the block at parse time.
– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl theif definedasures no doublettes are output.
– LotPings
Apr 25 at 22:36
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
am I understanding correctly that the first loop basically you are making %%A a variable for the second loop?
– Enzo
Mar 28 at 21:18
3
3
No, to assure no vars also begining with
_[ are present before processing. The trick is that although I'm setting a variable inside a (code block) the if defined will check the actual state and not the state when first entering the block at parse time.– LotPings
Mar 28 at 21:21
No, to assure no vars also begining with
_[ are present before processing. The trick is that although I'm setting a variable inside a (code block) the if defined will check the actual state and not the state when first entering the block at parse time.– LotPings
Mar 28 at 21:21
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
Thank you for making me less ignorant today!
– Enzo
Mar 28 at 21:29
@aschipfl the
if defined asures no doublettes are output.– LotPings
Apr 25 at 22:36
@aschipfl the
if defined asures no doublettes are output.– LotPings
Apr 25 at 22:36
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406174%2fcomparing-inside-for-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown