A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava in Batch page! Here, you'll find the source code for this program as well as a description of how the program works.
@echo off
rem Reference: https://rosettacode.org/wiki/Loops/For#Batch_File
SETLOCAL ENABLEDELAYEDEXPANSION
for /l %%n in (0,1,20) do (
rem num_spaces = abs(n - 10)
set /a "num_spaces=%%n-10"
if !num_spaces! lss 0 set /a "num_spaces=10-%%n"
rem num_stars = 21 - 2 * num_spaces
set /a "num_stars=21-(2*!num_spaces!)"
rem Get num_spaces " "
set "line="
if !num_spaces! gtr 0 (
for /l %%i in (1,1,!num_spaces!) do set "line=!line! "
)
rem Append num_stars "*"
for /l %%i in (1,1,!num_stars!) do set "line=!line!*"
rem Output line
echo !line!
)
ENDLOCAL
Baklava in Batch was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.