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

This commit is contained in:
Alexander Zhirov 2023-01-23 00:14:13 +03:00
parent 42b2af19c0
commit 09dc3df444
18 changed files with 261 additions and 1 deletions

View file

@ -0,0 +1,20 @@
import std.stdio;
void main()
{
auto f = function double(int x) { return x / 10.; };
auto a = f(5);
assert(a == 0.5);
double function(int) e = function double(int x) { return x / 10.; };
auto b = e(5);
assert(b == 0.5);
int h = 2;
auto g = delegate double(int x) { return h * x / 10.; };
auto i = g(5);
assert(i == 1);
h = 3;
auto j = g(5);
assert(j == 1.5);
}