A Coding challenge

Just finished writing an article called “Polymorphism Without Interfaces “. I challenge you to review and explain the code below (it ‘s written in ActionScript 3.0) :

for(var i:uint = 0; i lt; workers.length; i++) {

var p:* = workers[i][ “increasePay “];

output.text+=p==undefined? “no luck “:p(5);

}

The person who writes the best explanation, will get a free copy of my e-book “Java programming for kids, parents and grandparents “. I ‘m sure plenty of people understand the syntax, so I ‘m looking for an explanation of WHY it ‘s written this way.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s