alogo

Dart for JavaScript

[iframe width=”100%” height=”600″ src=”http://try.dartlang.org/”]

With Flash and Flex taking big hits as Adobe appears to be bowing under the pressure from Apple and Microsoft , getting to know Google’s Dart is going to be more important. Why? Because HTML5 is going to becarrying the load for not just Webbut also cross platform applications now that Adobe has all but deserted Flash+Flex=AIR. So get used to the Dartboard above because it is live and allows you to checkout live Dart code. Here is the place to go to get up to speed in Dart. Press on the play button in upper left of Dartboard to run the Dart program live here.

Dart Exercises

class Greeter { //comments in Dart are like Javascript and CSS
  var prefix = 'Hello,'; //semicolon is end of line delimiter
// all variables require var in declaration
// the method is greet()
  greet(name) {
//putting a dollar sign $ in front of a variable name
//causes it value to be fetched and used in print() statement
    print('$prefix $name');
  }
}
//every Dart program must have main() starting method
main() {
  var greeter = new Greeter();
  greeter.greet("Class!");
}

This introduces a simple Hello Class exercise that uses a class called Greeter. Note the basic syntax draws much from C, Java, and JavaScript. Copy the above code into the DartBoard and run it live by clicking on the play icon in the upper left of the the DartBoard.

Pin It on Pinterest