Loops/Foreach: Difference between revisions

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

edits