How would I express a chained assignment in Scala?

后端 未结 5 1487
南方客
南方客 2021-01-05 01:05

How would I express the following java code in scala?

a = b = c;

By the way, I\'m re-assigning variables (not declaring).

5条回答
  •  攒了一身酷
    2021-01-05 01:31

    b = c; a = b
    

    Awkward, I know. That's Scala pretty much telling you "don't do that". Consider it the Scala version of Python's space identation for block delimitation.

提交回复
热议问题