Re:Show HN: Array – A Better Python List
by bko on Sunday January 10, 2021 @11:52AM
(#25716562)
I agree. My main problem is I don't want intermediary variables floating around. Especially something like "areas". If python localized variables to a blocked namespace, I wouldn't mind
In scala:
---
val widths = Seq(1,2,3)
val heights = Seq(4,5,6)
widths.zip(heights).foreach { case (w, h) => {
val area = w * h
if (area > 10) {
println(s"Area: ${area}")
}
In scala:
---
val widths = Seq(1,2,3)
val heights = Seq(4,5,6)
widths.zip(heights).foreach { case (w, h) => {
}}println(area) // error: not found: value area