Else if?

Got a problem you cannot solve? Try here.
zchris
Posts: 92
Joined: Wed Feb 23, 2005 3:16 am
Location: Austria

Else if?

Postby zchris » Thu Sep 15, 2005 5:58 am

I am using Else If in my old setups - the command still works with the new InstallAware.

It is however missing in the commands list ... why?

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Sep 15, 2005 8:35 am

There were some very subtle bugs with this command. We didn't have time to fully fix them, so we removed it from the production builds, but as you notice, it is still available for backwards compatibility reasons. We do recommend that you replace all else-if commands in your script with an else and then a new if block.

deploy
Posts: 30
Joined: Mon Jan 14, 2013 1:39 am

Re: Else if?

Postby deploy » Wed Mar 06, 2013 6:56 am

Seven years later, "else if" is still listed in the help file, but not available as a command in the editor? I am using the latest version.
Is "else if" supposed to work or not?

Using if with multiple else will not work from what I can see. It will indent fine in editor, it will compile fine but not execute more than one else. In the example below the last else will never execute.

Don't know if I am totally blind at the moment, but I had to resolve this with some really ugly code using goto:s everywhere.

Code: Select all

  if Variable ENHET Equals 1
    if Variable isIE10 Equals TRUE
      do stuf
    else
      do stuff
    end
  else
    if Variable ENHET Equals 2
      if Variable isIE10 Equals TRUE
        do stuff
      else
        do stuff
      end
    end
  else
    if Variable isIE10 Equals TRUE
      this will never execute
    else
      nor will this
    end
  end


In my opinion "else if" is a useful command.

Regards,

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Else if?

Postby FrancescoT » Wed Mar 06, 2013 10:44 am

Dear User,

Unfortunately, "else if" is still not available ... and not because not useful.

Anyway, have you tried doing as?;

Code: Select all

  if Variable ENHET Equals 1
if Variable isIE10 Equals TRUE
   do stuf
else
   do stuff
end
 
if Variable ENHET Equals 2
  if Variable isIE10 Equals TRUE
    do stuff
  else
    do stuff
  end
end


Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

deploy
Posts: 30
Joined: Mon Jan 14, 2013 1:39 am

Re: Else if?

Postby deploy » Thu Mar 07, 2013 5:16 am

OK, then I know. Would be nice if "else if" would be reimplemented at some point in the future :)

Your example does not handle the case when ENHET does not equal 1 or 2 (the last else in my example) and since IA does not support logical operators in "If" I saw no other solution than using labels and Goto:s (or using yet another variable).

Anyways, the example really isn't important I mostly wanted to find out the status of "else if" since it was listed in the help file.

Regards,

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Else if?

Postby FrancescoT » Thu Mar 07, 2013 8:17 am

Dear User,

In reality the "Else If" statement used to exist.
It can still be loaded from scripts that use it (generated with past IA versions). However, it cannot be added to new scripts.

You can also use "Evaluate Expression" command where you can evaluate expressions as;
$A$ = "value1" or ($B$ = "value2" and $C$ = "value3")

Hope his helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Baidu [Spider] and 106 guests