Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Less than or equal to

Tags:

batch-file

Using the pause command I found that the error is in the first line of this code:

if %choice% == 1 if %energy% => %m2enc% set /a enemhp=%enemhp%-%m1hpd%+%earmr%
pause
set /a energy= %energy%-%m1enc%
set /a hp= %hp%-%edefense%
set /a defense= %defense%+1
goto battle

So don't say that I forgot to set the energy and the m2enc, because I did just in a different section, I also tried replacing %energy% with 10 and m2enc% with 1 and it still didn't work, I tried replacing the => with >= and with LSQ (apparently an alternative for less than or equal too) So I would like to know whats wrong with this part.

like image 795
Andenrx Avatar asked Aug 28 '13 23:08

Andenrx


People also ask

What is the difference between ≤ and ≥?

The notation a ≤ b or a ⩽ b means that a is less than or equal to b (or, equivalently, at most b, or not greater than b). The notation a ≥ b or a ⩾ b means that a is greater than or equal to b (or, equivalently, at least b, or not less than b).

What does >= mean in math?

The greater than or equal to symbol is used to represent inequality in math. It tells us that the given variable is either greater than or equal to a particular value. For example, if x ≥ 3 is given, it means that x is either greater than or equal to 3.

How do I type less than or equal?

Press and hold the Alt key and type 243 on your keypad.


3 Answers

In batch, the > is a redirection sign used to output data into a text file. The compare op's available (And recommended) for cmd are below (quoted from the if /? help):

where compare-op may be one of:      EQU - equal     NEQ - not equal     LSS - less than     LEQ - less than or equal     GTR - greater than     GEQ - greater than or equal 

That should explain what you want. The only other compare-op is == which can be switched with the if not parameter. Other then that rely on these three letter ones.

like image 138
Monacraft Avatar answered Sep 26 '22 04:09

Monacraft


There is no => for if.
Use if %energy% GEQ %m2enc%

See if /? for some other details.

like image 45
NiKiZe Avatar answered Sep 25 '22 04:09

NiKiZe


You can use:

EQU - equal

NEQ - not equal

LSS - less than

LEQ - less than or equal

GTR - greater than

GEQ - greater than or equal

AVOID USING:

() ! ~ - * / % + - << >> & | = *= /= %= += -= &= ^= |= <<= >>=

like image 36
user5830879 Avatar answered Sep 25 '22 04:09

user5830879