Custom Subscripting in Swift Tutorial

来源:互联网 发布:不用网络的游戏大全免费下载 编辑:程序博客网 时间:2024/06/03 05:31

*

subscript(coordinates: (Int,Int)) -> PlayerColor {  get {   }  set {   }}

The ~= operator (tilde and equals characters) tests to see if the range on the left contains the value on the right. Here, you make sure that each location's coordinate is in the range of 0-7. If not, you call the error message and return. 

0 0