checking "if a=b" like 10 times. is there a better way?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Murica
Posts: 29
Joined: 27 Nov 2022, 17:28

checking "if a=b" like 10 times. is there a better way?

Post by Murica » 01 Dec 2022, 13:03

is there a smarter way?

Code: Select all

if (p!=r0 && p!=r1 && p!=r2)
	{STUFF()
	}
	
R0=BLA
R1=BLA2
R2=BLA3
THANKS

User avatar
Chunjee
Posts: 1419
Joined: 18 Apr 2014, 19:05
Contact:

Re: checking "if a=b" like 10 times. is there a better way?

Post by Chunjee » 01 Dec 2022, 13:57

I call this smarter:

Code: Select all

A := new biga() ; requires https://github.com/biga-ahk/biga.ahk

r := ["BLA", "BLA2", "BLA3"]
p := "blah4"

if (A.includes(r, p)){
	; do something
}
https://biga-ahk.github.io/biga.ahk/#/?id=includes

teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: checking "if a=b" like 10 times. is there a better way?

Post by teadrinker » 01 Dec 2022, 14:03

Code: Select all

if p not in %r0%,%r1%,%r2%
{
   STUFF()
}

User avatar
Murica
Posts: 29
Joined: 27 Nov 2022, 17:28

Re: checking "if a=b" like 10 times. is there a better way?

Post by Murica » 01 Dec 2022, 18:53

wow thanks!!!!!

Post Reply

Return to “Ask for Help (v1)”