ZenScript main repository
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

functions2.zs 486B

12345678910111213141516171819
  1. val outOfScope = 10;
  2. val fun = (a as int, b as int) as int => a + b * outOfScope;
  3. println(fun(30, 20));
  4. function apply_fn2(fn as function(value as int, othervalue as int) as int, value as int) as int {
  5. return fn(value, value);
  6. }
  7. //function scale(value as int, scale as int) as int {
  8. // val fun as function(value as int, othervalue as int) as int = ((v as int) as int => v * scale);
  9. // return apply(fun, scale);
  10. //}
  11. apply_fn2(fun, 10);
  12. //println("Value: " + scale(10, 5));