I am working on spark project using Scala. I need to print each element of a list named 'c' along with a variable. I am using jdoodle right now to run this small code, I am getting "value foreach is not a member of Any" error and the error message points to the foreach in the print statement.
object Graph {
def main(args: Array[String]) {
val line="1,2,3,4,5,6"
val a = line.split(",")
val b=Seq(a(0),a(0),a.drop(1).toList)
val c=b(2)
print(Seq((b(0),b(1)),(c.foreach{x=>print(s"($x,$b(1))")})))
}
}
I want the result to be a sequence like this [(1,1)(2,1)(3,1)(4,1)(5,1)(6,1)]
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)