1 Reply Latest reply on Oct 26, 2011 11:58 PM by __SandraB

    If statement problem

    david567890 Level 1

      What I am trying to do is compare 2 variables and depending on the result, multiply a third variable by a constant. Heres the code:

       

                     var a:String=String (OCC.text)

                     var b:String=String (DCC.text)

                     var c:Number=Number (ATBC.text)

       

                     if (a == "GM" || "gm"{

                    

                          if (b == "AU" || "au"){

                    

                               var ae:Number=Number (c*0.95)

                               CA.text = String(ae)

       

                          }

       

                          else if (b == "NZ" || "nz"){

                              

                               var af:Number=Number (c*1.12)

          

                               CA.text = String(af)

                          }

       

      The problem is that when b = NZ, c is still multiplied by 0.95, not 1.12

       

      I am new to programming so any help is much appreciated.