Tag: 列举

Kotlin有像Python一样的“枚举”功能吗?

在Python中,我可以写: for i, element in enumerate(my_list): print i # the index, starting from 0 print element # the list-element 我怎样才能在Kotlin写这个?