Hallo, ich habe hier ein unvollständiges Ruby Programm indem ich Codefragmente einsetzen sollen, aber irgendwie bekomm ich es nicht hin. Zudem muss nicht jede Lücke gefüllt werden.
Danke im Voraus für die Hilfe!
Der Code:
1 def factorial ( i )
2 __blank1__
3 __blank2__
4 if ( i == 0) then
5 __blank3__
6 return f
7 else
8 __blank4__
9 end
10 __blank5__
11 end
Fragmente:
- cc.call(cc, f + p, f, i + 1)
- cc.call(cc, i * f, i - 1)
- cc.call(cc, f + p, i - 1)
- cc, f, p, i = callcc {|cc| [cc, 1, 0, 0]}
- (cc, f, i) = callcc{|cc| [cc, 1, i]}