Loops/Foreach: Difference between revisions
→{{header|Batch File}}
Simple9371 (talk | contribs) |
Simple9371 (talk | contribs) |
||
Line 274:
=={{header|Batch File}}==
The FOR command can imitate the "Foreach Loop". The whitespace and the comma (,) are the default delimiters.
'''Direct usage:'''
<lang dos>@echo off
for %%A in (This is a sample
echo %%A
)</lang>
'''Using a Collection Variable:'''
<lang dos>@echo off
set "collection=This is a sample
for %%A in (%collection%) do (
echo %%A
|