Added the []= overloadable operator and implemented it for vector, map, and string
This commit is contained in:
16
tests/test_bracket_assign.krak
Normal file
16
tests/test_bracket_assign.krak
Normal file
@@ -0,0 +1,16 @@
|
||||
import io:*
|
||||
|
||||
obj BracketAssign {
|
||||
fun operator[]=(index:int, rhs:int) {
|
||||
print("bracket assign: index: ")
|
||||
print(index)
|
||||
print(", rhs: ")
|
||||
println(rhs)
|
||||
}
|
||||
}
|
||||
|
||||
fun main():int {
|
||||
var test:BracketAssign
|
||||
test[4] = 9
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user