I am trying to figure out why this does not recognize "fork" ? I run it and it tells me hello or train
Datak = "fork"
{
If (Datak="hello" or "train")
{
MsgBox You wrote hello or train
}
else
If (Datak="fork")
{
MsgBox You wrote fork
}
}
If statement that brings back the wrong results Topic is solved
Re: If statement that brings back the wrong results
Code: Select all
Datak := "fork"
if (Datak = "hello") or (Datak = "train")
{
MsgBox % "You wrote hello or train"
}
else if (Datak = "fork")
{
MsgBox % "You wrote fork"
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: If statement that brings back the wrong results Topic is solved
The reason your If statements didn't work is because you tried to use statement mode vs. expression mode for setting variables.
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: If statement that brings back the wrong results
Thank you jNizM for that it makes sense now and works
Delta, ill read up on that so I can understand better
Delta, ill read up on that so I can understand better