|
|
|
|
|
|
|
|
|
|
|
|
Optional Argument
|
|
|
To allow subroutines to evolve over time without having to change all of the existing calls, Vera supports optional arguments. Optional arguments must have default values. To allow subroutines to evolve over time without having to change all of the existing calls, OpenVera supports optional arguments. Optional arguments must have default values. |
|
|
|
|
|
subroutine (type optional_arg1 = default_value,type
optional_arg2 = default_value, ...) {
statements
}
|
|
|
|
|
|
To allow subroutines to evolve over time without having to change all of the existing calls, OpenVera supports optional arguments. Optional arguments must have default values. |
|
|
|
|
|
|
|
|
|
|
|
Example : Optional Argument
|
|
|
|
|
|
1 program optional_value {
2 print(1);
3 print(1,2);
4 print(1,2,3);
5 }
6
7 task print (integer m, ((integer n = 100)), (integer o = 10)) {
8 printf("Inside m %0d\n",m);
9 printf("Inside n %0d\n",n);
10 printf("Inside o %0d\n",o);
11 }
You could download file optional_value.vr here
|
|
|
|
|
|
Simulation : Optional Argument
|
|
|
|
|
|
Inside m 1
Inside n 100
Inside o 10
Inside m 1
Inside n 100
Inside o 2
Inside m 1
Inside n 2
Inside o 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|