Henrique Dias 0afb9e732c update
Former-commit-id: bdede6ed1b6f578f2ef046c338caf02d0b29d453 [formerly 7187de361b53e9c8ec121df379b762f2db736ea2]
Former-commit-id: 447d58460fbbfd05ffe08428a1288e392637561d
2017-03-25 19:37:42 +00:00

20 lines
489 B
Dart

// Go ahead and modify this example.
import "dart:html";
// Computes the nth Fibonacci number.
int fibonacci(int n) {
if (n < 2) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
// Displays a Fibonacci number.
void main() {
int i = 20;
String message = "fibonacci($i) = ${fibonacci(i)}";
// This example uses HTML to display the result and it will appear
// in a nested HTML frame (an iframe).
document.body.append(new HeadingElement.h1()..appendText(message));
}