Can you use "else" multiple times in an IF Statement?

Get help with using AutoHotkey and its commands and hotkeys
TigerYT

Can you use "else" multiple times in an IF Statement?

Yesterday, 00:45

For example:

Code: [Select all] [Download] GeSHi © Codebox Plus

*Z::
toggle := !toggle
if (toggle) {
SendInput, 1
}
else {
SendInput, 2
}
Return


Would this work?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Alibaba
Posts: 470
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 01:21

No it wouldn’t. If always evaluates to true, then it will continue execution in the if block, or to false, then it continues in the else block. There are always exactly two cases, your example shows five different cases. Maybe you are looking for nested ifs, or else if.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

"Nothing is quieter than a loaded gun." - Heinrich Heine
Alibaba
Posts: 470
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 01:29

Please don’t open multiple topics with the same question. If you are posting as a guest you will have to wait for the topic approval and duplicating topics will only result in extra work for the moderation team, but not in a faster approval.
The time it takes the moderation team to check posts is depending on the current activity, so there are no guarantees. Consider registering an account. Once your account is approved you can post topics without waiting time.

Greetings,
Alibaba
"Nothing is quieter than a loaded gun." - Heinrich Heine
TigerYT
Posts: 7
Joined: Yesterday, 01:01

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 03:56

Alibaba wrote:Please don’t open multiple topics with the same question. If you are posting as a guest you will have to wait for the topic approval and duplicating topics will only result in extra work for the moderation team, but not in a faster approval.
The time it takes the moderation team to check posts is depending on the current activity, so there are no guarantees. Consider registering an account. Once your account is approved you can post topics without waiting time.

Greetings,
Alibaba


I didn't post multiple times. :?
Alibaba
Posts: 470
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 05:05

Well there where three topics called all the same, by a guest account called "TigerYT", i deleted two of them.
"Nothing is quieter than a loaded gun." - Heinrich Heine
TigerYT
Posts: 7
Joined: Yesterday, 01:01

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 05:34

Oh, Well maybe I clicked the 'submit' button multiple times and it didn't register as one topic?
Alibaba
Posts: 470
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Can you use "else" multiple times in an IF Statement?

Yesterday, 13:22

Whatever it was, it’s not that big of a deal, we won’t punish you for it. :D
Just watch out next time. :)
"Nothing is quieter than a loaded gun." - Heinrich Heine

Return to “Ask For Help”

Who is online

Users browsing this forum: Exaskryz, jamie1992, Sabestian Caine and 43 guests