Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Avoid Continued Lines In Source Code

Aug
1,943
71
To avoid long,
continued lines in your source code,
consider breaking down your code;
Code:
@setlocal
@echo off

COMMENT
     _x64: 1
   _admin: 1
_elevated: 1

TCC  30.00.18 x64   Windows 10 [Version 10.0.19044.2965]
ENDCOMMENT

set _a=10
set _b=20
::
:: Set _test as an equation
::
set _test=%%_a eq 10 .or. %%_b eq 10
echo Does %_test?
if (%_test) (echo Yes) else (echo No)
::
:: Adjust values of _a and _b
::
set _a=11
set _b=21
echo Does %_test?
if (%_test) (echo Yes) else (echo No)
endlocal

After running the above;
Code:
Does 10 eq 10 .or. 20 eq 10?
Yes
Does 11 eq 10 .or. 21 eq 10?
No

Joe
 
Back
Top