I'm new to scala and I'm trying to learn it. I'm stuck with an very simple thing which I cannot figure out. I simply want, inside a for loop, to check if the current item is present in a map then use that value, otherwise calculate it with a function. It should be preatty easy but coming from python I cannot understand where the mistake is.
val predictions = for (review <- testValuesAsList;
if (storage.contains("review")){prediction = mymap("review")}
else {prediction = computeItemAvgRat(review._2, trainValuesAsList)}
) yield (review._3, prediction)
return predictions