Author Topic: Is this the correct usage in this one line of code  (Read 2022 times)

0 Members and 1 Guest are viewing this topic.

Offline GrandewdTopic starter

  • Full Member
  • ***
  • Posts: 239
  • Activity:
    0%
  • Reputation Power: 3
  • Grandewd has no influence.
  • Respect: +24
  • Referrals: 0
    • View Profile
Is this the correct usage in this one line of code
« on: August 31, 2013, 06:30:41 PM »
0
Ok, here's that one line of code:   
Is this proper:

Code: [Select]
if #chardir <> 2 & #charX <> %mastX

or do I need to add parenthesis, as in:

Code: [Select]
if ( #chardir <> 2 ) & ( #charX <> %mastX )
or are both acceptable?

 :-[  :-\  ::)

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: Is this the correct usage in this one line of code
« Reply #1 on: August 31, 2013, 07:00:09 PM »
0
I do not remember being able to use the and symbol in an if statement (under easyuo scripting that is). So my response would be neither.

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Is this the correct usage in this one line of code
« Reply #2 on: August 31, 2013, 07:50:13 PM »
0
Code: [Select]
if ( #chardir <> 2 ) && ( #charX <> %mastX )
I honestly cant remember much of EUO syntax, but I do believe that it requires "&&" as opposed to "&".

Parenthesis are in relation to what you want to be compared first. It's just good practice to use them imo. For longer compares it really matters though.
« Last Edit: August 31, 2013, 07:54:41 PM by dxrom »



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Offline GrandewdTopic starter

  • Full Member
  • ***
  • Posts: 239
  • Activity:
    0%
  • Reputation Power: 3
  • Grandewd has no influence.
  • Respect: +24
  • Referrals: 0
    • View Profile
Re: Is this the correct usage in this one line of code
« Reply #3 on: August 31, 2013, 08:43:33 PM »
0
Code: [Select]
if ( #chardir <> 2 ) && ( #charX <> %mastX )
I honestly cant remember much of EUO syntax, but I do believe that it requires "&&" as opposed to "&".

Parenthesis are in relation to what you want to be compared first. It's just good practice to use them imo. For longer compares it really matters though.

You're right on both counts, dxrom... The EUO syntax does call for an && - can't believe I forgot that.... And you're really right about the importance of using parenthesis - at the very least for an appreciation of the esthetic beauty of orderly code - if not a much easier way to spot what they point us to...
But hey, look at the bright side... My forgetfulness allowed us (well at least one of us) a moment to enjoy the memories... Right?   ::)
« Last Edit: September 01, 2013, 01:23:34 AM by Grandewd »

Tags: