ZenScript main repository
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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));