mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
72 lines
1.2 KiB
Text
72 lines
1.2 KiB
Text
//declare function foo2();
|
|
//declare function foo3(a, b, c);
|
|
//declare function foo5(a , g);
|
|
|
|
var a := "ll"; // MID( "hello world", 3, 2 );
|
|
|
|
function foo1()
|
|
print( "foo1" );
|
|
endfunction
|
|
|
|
function foo2( a )
|
|
print( "foo2: a=" + a );
|
|
endfunction
|
|
|
|
function foo3( a := 5 )
|
|
print( "foo3: a=" + a );
|
|
endfunction
|
|
|
|
function foo4( a, b:="hello" )
|
|
print( "foo4: a=" + a );
|
|
print( "foo4: b=" + b );
|
|
endfunction
|
|
|
|
function foo5( a:=1, b:=2 )
|
|
print( "foo5: a=" + a );
|
|
print( "foo5: b=" + b);
|
|
endfunction
|
|
|
|
function foo6( a := 2, b )
|
|
print( "foo6: a=" + a );
|
|
print( "foo6: b=" + b );
|
|
endfunction
|
|
|
|
function foo7( a := 2, b, c := 7 )
|
|
print( "foo7: a=" + a );
|
|
print( "foo7: b=" + b );
|
|
print( "foo7: c=" + c );
|
|
endfunction
|
|
|
|
|
|
// Program Start
|
|
|
|
var b, c;
|
|
|
|
print( "Program Starting - Function Test (Func1.src)" );
|
|
a := 5;
|
|
b := 7+8;
|
|
foo5( 6, 2 );
|
|
c := foo5( 7, 1 );
|
|
|
|
foo1();
|
|
foo2("hello");
|
|
foo3();
|
|
foo3("hello foo3");
|
|
foo3(5.4);
|
|
foo3( a := 6 );
|
|
foo3( a := "hey" );
|
|
foo4( a:= 3, b := 6);
|
|
foo5( 17, 32 );
|
|
foo5( 12 );
|
|
foo5();
|
|
foo5( a := 2 );
|
|
foo5( a := 8, b := 4 );
|
|
foo5( b := 3 );
|
|
foo5( b := 9, a := 3 );
|
|
|
|
// Any of these lines should break the compile.
|
|
//foo1( 3 );
|
|
//foo1( "hello" );
|
|
//foo1( a := 4 );
|
|
//foo7( b := "blah blah" , 3, 2);
|
|
|