Sign in to follow this  
Followers 0
hrabikk

Select with multiple Variables

3 posts in this topic

Hello

I got a question. Is there any other way to do Select function:

We got 5 different vars: $1=true or false, $2=true or false and $3=true or fallse

And now the select function

Select
Case $1=true and $2=true and $3=true
 ..do something..
Case $1=false and $2=false and $3=false
 ..do something..

So with three variables we need to write 8 different combinations. Thats not really hard, but when we got 8 different variables we need to make 256 Cases. Is there any easier way to do such a thing?

Like for example:

Case $1=true and ($2=True or False)

Any ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You first need to answer the question how many Case statements you would have for the 256 different options?

So tell us what you want to do for each case you identify.

This statement " Case $1=true and ($2=True or False)" doesn make much sense as examples since that is the same as "Case $1=true".

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

As each variable can only have 2 states (True or False) checking for both of them can be dropped. Means:

Case $1=true and ($2=True or False)

is equivalent to

Case $1=true

Edit: Jos was faster!

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0