Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK v2 problem with "&&" [possible BUG]

Author
Message
ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 28th Dec 2014 20:23
I have a problem with "&&" in coding. It doesn't work properly. For example: You want to check if 2 variables are correct and execute the code if they are correct. But it will execute the code only if 1 variable is correct. If I use "and" then it works perfect. Is this a bug?
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 29th Dec 2014 04:43
how bout use <> or = or => or =<

i have no idea what && is even used for ... is that tier 1 or 2?
normaly i would just write

if a=1 and b=1 then do_what_ever()

got any code to share?

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 29th Dec 2014 05:28
I think "&&" is relate to tier 2 (c++). do you use "&&" in tier 2?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Dec 2014 05:38 Edited at: 29th Dec 2014 05:39
&& is the bitwise and operator in AppGameKit (equivalent to & in most other languages). and is the logical operator (equivalent to && in most other languages).

ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 29th Dec 2014 14:55
@SoftMotion3D
"&&" is the same as "and".

@Behdadsoft
So && works only in tier 2? I didn't test this in tier 2, but "and" works fine with tier 1.
ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 29th Dec 2014 15:00
I find out that & works fine with tier 1.
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 29th Dec 2014 22:17
It depends how = and so on are evaluated. If you know they evaluate to 0 and -1 it works. But anything else, and it might not, if you are using bitwise and.

A good rule of thumb is only to do bitwise ANDs when you actually definitely want logical opereations.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 30th Dec 2014 03:26
Quote: "I find out that & works fine with tier 1."

& is a compiler error for me in tier 1, V1. As SoftMotion asked, are you using Tier 1 (BASIC) or Tier 2 (C++)?

Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 30th Dec 2014 08:05
Quote: "I find out that & works fine with tier 1."


It shouldn't. You should be using "and".


Sean

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 30th Dec 2014 10:18
& is an error in V2 T1, as it should be.

-- Jim - When is there going to be a release?
ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 30th Dec 2014 14:04
Ok, thanks everyone for answers.

Login to post a reply

Server time is: 2024-05-20 05:42:09
Your offset time is: 2024-05-20 05:42:09