operator.
#1

How can optimize?
Код HTML:
if(price < 1000 || price > 200000) return SendClientMessage(playerid, COLOR_DARKGRAY, "ERROR.");
Reply
#2

It's already fine how it is.
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
It's already fine how it is.
Not work...
Код HTML:
if(1000 < price > 200000) return SendClientMessage(playerid, COLOR_DARKGRAY, "ERROR.");
Reply
#4

Quote:
Originally Posted by KessMan
Посмотреть сообщение
Not work...
Код HTML:
if(1000 < price > 200000) return SendClientMessage(playerid, COLOR_DARKGRAY, "ERROR.");
Try it...
Reply
#5

Quote:
Originally Posted by KessMan
Посмотреть сообщение
How can optimize?
Код HTML:
if(price < 1000 || price > 200000) return SendClientMessage(playerid, COLOR_DARKGRAY, "ERROR.");
Price < 1000: Price can be negative infinity to 999
Price > 200000: Price can be 200001 to positive infinity

Quote:
Originally Posted by KessMan
Посмотреть сообщение
Not work...
Код HTML:
if(1000 < price > 200000) return SendClientMessage(playerid, COLOR_DARKGRAY, "ERROR.");
1000 < price > 200000: Doesn't work in Pawn EDIT: I was wrong, this syntax does work! The rest of my post is still valid though. + if this syntax would work, it's not even the same as the first code
1000 < price: Price can be 1001 to positive infinity
price > 200000: Price can be 200001 to positive infinity
Reply
#6

I always use something like:
PHP код:
if(!(1000 <= price <= 200000)) 
But that's just my personal preference.
Reply
#7

Quote:
Originally Posted by Threshold
Посмотреть сообщение
I always use something like:
PHP код:
if(!(1000 <= price <= 200000)) 
But that's just my personal preference.
Omg, that syntax actually works in Pawn? Didn't even know! Glad I learned something!

Код:
//This:
if(1000 < price && price < 200000) {
    ...
}
//Is the same as this:
if(1000 < price < 200000) {
    ...
}
//And it actually works in this language.
Reply
#8

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Omg, that syntax actually works in Pawn? Didn't even know! Glad I learned something!

Код:
//This:
if(1000 < price && price < 200000) {
    ...
}
//Is the same as this:
if(1000 < price < 200000) {
    ...
}
//And it actually works in this language.
People have said that it is slower. So you aren't really optimizing anything.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)