Structure of Batch Program [6/8]

Опубликовано: 09 Февраль 2012
на канале: VoiceTutorial
760
7

Summary: To separate functions in a batch program, we can use the decisions and "goto" command we learned earlier. Create a variable with two values, e. g. "0" for "do not execute function" and "1" for "do execute this function". The function is created with an if statement testing for that value, and a label to the goto target.

In this video we had a function called "Addition," and to that we had the following code:

::sets function to not execute by default
set add=0

::this is the actual function, or "function body"
:Addition
if %add% == 1 (
::commands go here
set /a answer=%num1% + %num2%
set add=0
)

::to call the function use
set add=1
goto Addition

Mathematical Operators:
"-" Subtraction
"+" Addition
"*" Multiplication
"/" Division
set /a variable=arithmetic + expression


Смотрите видео Structure of Batch Program [6/8] онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь VoiceTutorial 09 Февраль 2012, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 76 раз и оно понравилось людям.