• + 3 comments

    I'm getting a weird error message:

    Solution.scala:16: error: not found: value f
      f(n)
      ^
    one error found
    

    Here's everything I have (Scala):

    object Solution extends App {
        object Solution {
    
            def main(args: Array[String]) {
                val sc = new java.util.Scanner (System.in);
                var n = sc.nextInt();
    
    
                def f(n: Int) = {
                    for(i <- 0 until n) {
                        println("Hello World");
                    }
                }
            }
    
        }
        var n = scala.io.StdIn.readInt
        f(n)
    }
    

    Am I just putting the f(n) in the wrong place?