From 951d6c97bdd253575ee1dd11b343786b27b8bda9 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 17 Jul 2015 14:51:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D1=91?= =?UTF-8?q?=D0=BD=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- program.own | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/program.own b/program.own index 3a8dbf1..6dedf11 100644 --- a/program.own +++ b/program.own @@ -62,4 +62,23 @@ print arr[4][1] + "\n" print "\n\n" array = newarray(2, 2, 2, 2) -print array \ No newline at end of file +print array + +add = def(a,b) return a+b +sub = def(a,b) return a-b +mul = def(a,b) return a*b +div = def(a,b) return a/b +cube = def(x) return x*mul(x, x) +print "\n\n" +print mul(8, 5) +print "\n" +print cube(2) + +functions = [add, sub, mul, div] +def function(f, a, b) return f(a, b) +for i = 0, i < 4, i = i + 1 { + print "\n" + print functions[i] + print "\n" + print function(functions[i], 6, 3) +} \ No newline at end of file