Глава 4 закончена

This commit is contained in:
Alexander Zhirov 2023-02-25 17:15:12 +03:00
parent 141dd624b1
commit e57718386b
26 changed files with 442 additions and 2 deletions

View file

@ -0,0 +1,15 @@
import std.stdio;
void main()
{
auto array = [0, 2, 4, 6, 8, 10];
array = array[0 .. $ - 2];
// Су­же­ние спра­ва на два эле­мен­та
assert(array == [0, 2, 4, 6]);
array = array[1 .. $];
// Су­же­ние сле­ва на один эле­мент
assert(array == [2, 4, 6]);
array = array[1 .. $ - 1];
// Су­же­ние с обе­их сто­рон
assert(array == [4]);
}