Skip to content

Instantly share code, notes, and snippets.

@back2dos
Created February 6, 2013 00:00
Show Gist options
  • Select an option

  • Save back2dos/4718931 to your computer and use it in GitHub Desktop.

Select an option

Save back2dos/4718931 to your computer and use it in GitHub Desktop.
Flon's Law at work.
class A {
public var i(get, null):Int;
public function new() i = 0
function get_i() return i--
}
class Main {
static function main()
switch (new A()) {
case a if (a.i < 0): trace('negative');
case a if (a.i == 0): trace('zero');
case a if (a.i > 0): trace('positive');
default: trace('without sign')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment