diff --git a/version2.0/numeral_misc.h b/version2.0/numeral_misc.h index 886a697..b8bc5e8 100644 --- a/version2.0/numeral_misc.h +++ b/version2.0/numeral_misc.h @@ -48,6 +48,7 @@ bool check_numerable_string(std::string str) } return false; } + double trans_string_to_number(std::string str) { bool is_negative=false; @@ -118,6 +119,7 @@ double trans_string_to_number(std::string str) trans_str_number*=-1; return trans_str_number; } + std::string trans_number_to_string(double number) { std::string trans_num_string=""; diff --git a/version2.0/run/closure.nas b/version2.0/run/closure.nas index ff6406f..5d6b467 100644 --- a/version2.0/run/closure.nas +++ b/version2.0/run/closure.nas @@ -43,4 +43,14 @@ var cl_fun=func(x) b=cl_fun(1); c=cl_fun(10); print(b()); -# output 1 \ No newline at end of file +# output 1 + +a=3; +b=0; +if(a==3) +{ +var c=10; +b=func{return c;}; +} +print(b()); +# output 10 \ No newline at end of file diff --git a/version2.0/run/run1.nas b/version2.0/run/run1.nas new file mode 100644 index 0000000..87cb37b --- /dev/null +++ b/version2.0/run/run1.nas @@ -0,0 +1,8 @@ +var f=func(x) +{ + if(x>9)return; + x+=1; + f(x); + return; +} +f(0); \ No newline at end of file diff --git a/version2.0/run/run2.txt b/version2.0/run/run2.txt new file mode 100644 index 0000000..4c506b7 --- /dev/null +++ b/version2.0/run/run2.txt @@ -0,0 +1,4 @@ +var hash={ + str:1, + f:func{print(me.str);} +}; \ No newline at end of file