If i want to return two Gravity values at same time in java, I do this:
private int rightCenterVertical() {
return Gravity.RIGHT | Gravity.CENTER_VERTICAL;
}
How can that be transformed to kotlin code?
To be honest, I don't know how it's called the "|
" operator from java that is used to mix two values and return both of them.
CodePudding user response:
In kotlin it is just called or
so your code would look like this:
fun rightCenterVertical(): Int {
return Gravity.RIGHT or Gravity.CENTER_VERTICAL
}