File: optional_parameters.sce

package info (click to toggle)
scilab 5.5.1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 337,804 kB
  • ctags: 69,618
  • sloc: xml: 770,056; ansic: 295,010; java: 187,293; fortran: 155,805; cpp: 66,211; ml: 24,230; sh: 23,700; tcl: 14,792; makefile: 8,315; perl: 1,566; php: 690; cs: 614
file content (17 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example with optional argument specified with the 'arg=value syntax'
// [a,b,c] = ex12c(x1, [v1 = arg1, v2 = arg2]), arg1 default value 99
//					        arg2 default value 3
// only v1 and v2 are recognized as optional argument names
// the return value are a = x1, b = 2*v2, c = 3*v2

[a,b,c] = optional_parameters("test");
disp("a = " + a + " b = " + string(b) + " c = " + string(c));

[a,b,c] = optional_parameters("test",v1=[10,20]);
disp("a = " + a + " b = " + string(b) + " c = " + string(c));

[a,b,c] = optional_parameters("test",v1=[10,20],v2=8);
disp("a = " + a + " b = " + string(b) + " c = " + string(c));

[a,b,c] = optional_parameters("test",v2=8,v1=[10]);
disp("a = " + a + " b = " + string(b) + " c = " + string(c));