mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
14 lines
308 B
Plaintext
14 lines
308 B
Plaintext
fn int main(String[] args)
|
|
{
|
|
MyArray a = {{1, 4, 3, 6, 5}};
|
|
a[0] = a[1]; // #error: Assigning to a subscript of 'MyArray' is not possible
|
|
return 0;
|
|
}
|
|
|
|
struct MyArray
|
|
{
|
|
int[] val;
|
|
}
|
|
|
|
fn int MyArray.get(self, usz idx) @operator([]) => self.val[idx];
|
|
fn usz MyArray.len(self) @operator(len) => self.val.len; |