在 Python 中,我可以做類似的事情
long_declaration_and_long_variable_name = \
foo_bar.this_is_a_really_long_function_name_and_its_only_getting_longer["baz"]
有可能在 Kotlin 中做這樣的事情嗎?
我完全知道在 Kotlin 中你可以為鏈式換行,比如
val xyz = foo_bar.this_is_shorter
.so_I_can_break(this_up)
.into_individual_lines(like_so)
但是,在我的例子中,函式名很長,我只想把它放在下一行
uj5u.com熱心網友回復:
我不確定我是否理解正確但在 Kotlin 中你可以像在 Python 中那樣做(事實上更簡單因為你不需要使用\符號)
val long_declaration_and_long_variable_name: SomeLongTypeName =
foo_bar.this_is_a_really_long_function_name_and_its_only_getting_longer("some long argument string")
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/533721.html
標籤:科特林变量多行
