Jump to content

combining if statments


Recommended Posts

Im trying to do multiple combinations of... im not sure what to call it.... in an if statment and im not sure its correct...

example

If A and B both are true as one option

If C and D both are true as a second option

How can i do if (A and :) or (C and D) are true then do the if statment.

How do i do this?

Link to comment
Share on other sites

something like this ?

$a=1
$b=1
if $a=1 and $b=1 then 
...
else
...
endif

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

more like

$a=1
$b=1
$c=1
$d=1

if $a=1 and $b=1 or $c=1 and $d=1 then 
endif

to trigger both A and B should be 1, or C and D, or all four...

i tried this, but it seems it doesnt want to work, im thinking its got something to do with order of events and needing brackets or something, but i dont know if i can do that...

Link to comment
Share on other sites

While $a=1 and $b=1
if $c=1 and $d=1 then
Exitloop
Endif
Wend

if $a=1 and $b=1 and $c=1 and $d=1 then
;the result at last ...
endif

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

i want it to trigger if both a and b are true or if both c and d are true...

you should post this at first of your topic

...as a fix as daniel's code

$a=1
$b=1
$c=1
$d=1

If ($a=1 And $b=1) Or ($c=1 And $d=1) Then
;whatever
EndIF

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

you should post this at first of your topic

...as a fix as daniel's code

$a=1
$b=1
$c=1
$d=1

If ($a=1 And $b=1) Or ($c=1 And $d=1) Then
;whatever
EndIF
To the topic author:

Pay attention, this code checks if $a, $b, $c, $d equal one, not if they're true. Being 'True' means being anything different than 0, including 1 and all other possible values, so you should use 'If $MyVar Then' instead of 'If $MyVar = 1 Then'.

Edited by danielkza
Link to comment
Share on other sites

To the topic author:

Pay attention, this code checks if $a, $b, $c, $d equal one, not if they're true. Being 'True' means being anything different than 0, including 1 and all other possible values, so you should use 'If $MyVar Then' instead of 'If $MyVar = 1 Then'.

Ya well im not exactly always using vars, but there have been many parts where i wanted to add multiple instances to an if statment, and i couldnt make the if statments work...

And i wasnt quite sure how to ask what i was asking, which is why it all wasnt in the first post... i tried my best to explain what i was trying to do, and eventually the idea got through...

using brackets looks like its gonna work

if (1 = 1 and 2 = 2) or (3 = 3 and 4 = 4) then, etc. By true i meant the expression was true, $a = 1, etc. Doesnt matter what the equation is, as long as it passes the test.

i didnt know brackets could be used, but that makes it easier. Now more of my programs will be better created. Thanks!

Edited by pileot
Link to comment
Share on other sites

To the topic author:

Pay attention, this code checks if $a, $b, $c, $d equal one, not if they're true. Being 'True' means being anything different than 0, including 1 and all other possible values, so you should use 'If $MyVar Then' instead of 'If $MyVar = 1 Then'.

i don't mentioning about 'True' or 'False' in my the code i've changed, i declared $a=1 ... $d=1 and i use if to check that, the topic starter should be smart enough to learn from that example

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...