If I use an Assignment within conditional, for e.g. if(userType='admin') Flex throws a warning,unlike Java, which throws an error. Why should Flex be doing this, despite being one of the newest languages? 1100: Assignment within conditional. Did you mean == instead of =?
If I use an Assignment within conditional, for e.g. if(userType=’admin’) Flex throws a warning,unlike
Share
Because assignments have a value in Actionscript, which makes that syntax legal, and they don’t have a value in Java, which makes it not. The difference comes because despite recent Java-izations, Actionscript is descended from ECMAScript. Other consequences of this design are the ability to make statements like this:
IMO, this is the best behavior it could have – it doesn’t break compatibility with older versions of Actionscript, and it doesn’t remove language functionality for the purpose of handholding, but it does bring a common error to the attention of the user.