Skip to content

Instantly share code, notes, and snippets.

@jgranick
Created April 16, 2012 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgranick/2399666 to your computer and use it in GitHub Desktop.
Save jgranick/2399666 to your computer and use it in GitHub Desktop.
A quick contrast of code styles
class MyCoolClass {
var message:String;
var total:Float;
public function new () {
var hello = combineText ("H", "ello");
var world = combineText ("W", "orld");
message = combineText (hello, world);
total = combineNumbers (100, 10.1);
}
function combineNumbers (first, second) {
return first + second;
}
function combineText (first, second) {
return first + second;
}
}
package my.cool.package;
class MyCoolClass {
private var message:String;
private var total:Float;
public function new () {
var hello:String = combineText ("H", "ello");
var world:String = combineText ("W", "orld");
message = combineText (hello, world);
total = combineNumbers (100, 10.1);
}
private function combineNumbers (first:Float, second:Float):Float {
return first + second;
}
private function combineText (first:String, second:String):String {
return first + second;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment