fork download
  1. public class Fibonacci {
  2.  
  3. public static List<Integer> generateFibonacci(int n) {
  4. List<Integer> fibSeries = new List<Integer>();
  5. Integer a = 0, b = 1;
  6.  
  7. for (Integer i = 0; i < n; i++) {
  8. fibSeries.add(a);
  9. Integer next = a + b;
  10. a = b;
  11. b = next;
  12. }
  13.  
  14. return fibSeries;
  15. }
  16. }
  17.  
Success #stdin #stdout #stderr 0.01s 8948KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #Fibonacci
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #Fibonacci (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:3: parse error, expected '}'