1234567891011121314151617181920212223242526 |
- void fun(int x)
- {
- x += 42;
- }
- void gun(int[] x)
- {
- x = [ 1, 2, 3 ];
- }
- void hun(int[] x)
- {
- x[0] = x[1];
- }
- unittest
- {
- int x = 10;
- fun(x);
- assert(x == 10); // Ничего не изменилось
- int[] y = [ 10, 20, 30 ];
- gun(y);
- assert(y == [ 10, 20, 30 ]); // Ничего не изменилось
- hun(y);
- assert(y == [ 20, 20, 30 ]); // Изменилось!
- }
|