You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
given (x: Array[Char]) extended with {
inline def swap(i: Int, j: Int) : Unit =
val v = x(i)
x(i) = x(j)
x(j) = v
}
val a = Array('A','B')
a.swap(0,1)
println(a.toList)
// Run Result
List(B, B)
// Expectation
List(B, A)
If "inline" is removed, the expectation is fulfilled