2
我有一些代碼,這是否:習慣scala處理文件A或文件B?
for d in directories:
if d/f1 exists: process d/f1
else if d/f2 exists: process d/f2
else skip
其中,「過程」,在這種情況下是:
read all the lines and save them for later use
什麼是一些慣用的方式在Scala中做到這一點?
你描述的不是它,它可能是f1或f2或兩者都沒有 – Ashalynd
謝謝 - 編輯僞代碼來澄清。 –