Jump to content

Select with multiple Variables


Recommended Posts

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?

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...