RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] && or and?

0 Members and 1 Guest are viewing this topic.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I've been looking through a number of scripts recently, and noticed that the most revered and more experienced scripters use && where and could be used. I know that there's a bug in XP for and, but is it the same for VX or is it just personal preference?
Do they even do different things?
it's like a metaphor or something i don't know

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
"and does the same as &&, but is a lower priority operator."

Taken straight from the RPGVX help file. I'm not sure about their exact priorities though. They're pretty much interchangeable.

*
Rep:
Level 82
I generally use && for it (similarly I use || for or), but that's because I come from a C++ background where it's used like that. But there's not too much difference between the two as far as I know, so it's probably just preference. (Edit: except for the priorities as Cozzie says).

I don't know much about RMXP though, only VX, so whether there are any issues that have remained in things like && and 'and' I have no idea.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Righto, so I guess it's mainly a preference thing. I prefer and.
@cozzie, it's so easy to miss things in the help file, isn't it?
it's like a metaphor or something i don't know

*
Rep: +0/-0Level 69
Misanthrope
Code: [Select]
a = true && false
=> false # a is false
a = true and false
=> false # a is true
&& for me makes more sense, and if I want to use 'and', I'll use && with some parentheses.
« Last Edit: June 12, 2011, 11:32:14 AM by IMP1 »

**
Rep:
Level 82
Code: [Select]
::
[]
**
-(unary)  +(unary)  !  ~
*  /  %
+  -
<< >>
&
|  ^
> >=  < <=
<=> ==  === !=  =~  !~
&&
||
..  ...
?:(conditional operator)
=(+=, -= ... )
not
and or

Its is safer to use a "&&" to avoid the statement from being interpreted wrong, though I personally use () in such situations anyway just to make the code a little more over-viewable.