- Joined
- Jan 28, 2023
- Messages
- 5
- Reaction score
- 0
exercise 1:
@echo off
setlocal enabledelayedexpansion
rem create list
set a[0]=michael
set a[1]=pique
set a[2]=elias
set a[3]=george
set a[4]=tobias
rem based on the table above and using
rem command for create the following content display:
michael tobias
pique george
elias elias
george pique
tobias michael
exercise 2:
make the (for) command work properly with the (reverse) command
@echo off
setlocal enabledelayedexpansion
rem create list
set a[0]=1
set a[1]=2
set a[2]=3
set a[3]=4
set a[4]=5
for /L %%x in (0,1,4) do (
set /a "reverse=4-%%x"
echo !a[%%reverse]!
rem echo !reverse!
)
pause
@echo off
setlocal enabledelayedexpansion
rem create list
set a[0]=michael
set a[1]=pique
set a[2]=elias
set a[3]=george
set a[4]=tobias
rem based on the table above and using
rem command for create the following content display:
michael tobias
pique george
elias elias
george pique
tobias michael
exercise 2:
make the (for) command work properly with the (reverse) command
@echo off
setlocal enabledelayedexpansion
rem create list
set a[0]=1
set a[1]=2
set a[2]=3
set a[3]=4
set a[4]=5
for /L %%x in (0,1,4) do (
set /a "reverse=4-%%x"
echo !a[%%reverse]!
rem echo !reverse!
)
pause