Permalink
Browse files

Update getFibs functions to use the n argument

  • Loading branch information...
1 parent be4d2d4 commit 0ee2646783a067226df962661b391d0fa3818174 @savulchik savulchik committed Feb 19, 2016
Showing with 3 additions and 3 deletions.
  1. +3 −3 posts/2 - Strategic Scala Style: Principle of Least Power.md
@@ -337,7 +337,7 @@ This:
```scala
def getFibs(n: Int): Seq[Int] = {
val fibs = mutable.Buffer(1, 1)
- while(fibs.length < 100){
+ while(fibs.length < n){
fibs.append(fibs(fibs.length-1) + fibs(fibs.length-2))
}
fibs
@@ -352,7 +352,7 @@ def getFibs(n: Int, fibs: mutable.Buffer[Int]): Unit = {
fibs.clear()
fibs.append(1)
fibs.append(1)
- while(fibs.length < 100){
+ while(fibs.length < n){
fibs.append(fibs(fibs.length-1) + fibs(fibs.length-2))
}
}
@@ -1243,4 +1243,4 @@ ad-hoc way of passing parameters to a function call.
[Scala Parallel Collections Library]: http://docs.scala-lang.org/overviews/parallel-collections/configuration.html#task-support
[Runnable]: https://docs.oracle.com/javase/7/docs/api/java/lang/Runnable.html
-[Comparator]: https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html
+[Comparator]: https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html

0 comments on commit 0ee2646

Please sign in to comment.