This commit is contained in:
parent
2c557f097a
commit
73f73d81c6
3
ase/test/awk/lang-001.awk
Normal file
3
ase/test/awk/lang-001.awk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
function f(f) { print f; }
|
||||||
|
BEGIN { f("hello"); }
|
5
ase/test/awk/lang-002.awk
Normal file
5
ase/test/awk/lang-002.awk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function f(f)
|
||||||
|
{
|
||||||
|
print f;
|
||||||
|
f("my hello");
|
||||||
|
}
|
3
ase/test/awk/lang-003.awk
Normal file
3
ase/test/awk/lang-003.awk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# should print 50
|
||||||
|
function fn(f) { f = 20; }
|
||||||
|
BEGIN { f = 50; fn(100); print f; }
|
3
ase/test/awk/lang-004.awk
Normal file
3
ase/test/awk/lang-004.awk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# A function and a named variable cannot have the same name.
|
||||||
|
function a () { }
|
||||||
|
BEGIN { a = 20; }
|
3
ase/test/awk/lang-005.awk
Normal file
3
ase/test/awk/lang-005.awk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function a () { }
|
||||||
|
BEGIN { local a; a = 20; }
|
||||||
|
|
2
ase/test/awk/lang-006.awk
Normal file
2
ase/test/awk/lang-006.awk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
global a;
|
||||||
|
function a () { }
|
4
ase/test/awk/lang-007.awk
Normal file
4
ase/test/awk/lang-007.awk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function fn () { a = 20; return a;}
|
||||||
|
global a;
|
||||||
|
BEGIN { a = 30; print fn (); print a; }
|
||||||
|
|
16
ase/test/awk/lang-008.awk
Normal file
16
ase/test/awk/lang-008.awk
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
global x;
|
||||||
|
BEGIN {
|
||||||
|
x = 1;
|
||||||
|
{
|
||||||
|
local x;
|
||||||
|
x = 2;
|
||||||
|
{
|
||||||
|
local x;
|
||||||
|
x = 3;
|
||||||
|
print x;
|
||||||
|
}
|
||||||
|
print x;
|
||||||
|
}
|
||||||
|
print x;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user