Function without any input value/default value 
////////////////////////////////
Function without any input value 
-------------------------
such as q()

Default input value
-------------------
We could give a default value to an input value 

See an example below. 

  dd<-function(x=10)x^2    

////////////////////////////////

definition of IRR (Internal Rate of Return) and IRR rule 
////////////////////////////////
IRR is the discount rate makes NPV equal zero. 
   IRR rule:

        if IRR(project) > Rc  accept

        if IRR(project) < Rc  reject

    Rc is the cost of capital of the project

////////////////////////////////

well-indented codes are more readable
////////////////////////////////
It is a good idea to indent our program 
that we could read it easily. See the difference between the following two examples. 

Well indented one
----------------
Objective    : estimate present value
                      fv
  formula used: pv= --------
                    (1+r)^n

           pv : present value
           fv : future value
           r  : effective period rate
           n  : number of periods

 Example 1: > .pv_f(0.1,1,100)     # meaning of inputs depend on order
             [1] 90.90909

 Example 2: > .pv_f(0.045,5,225)
             [1] 180.5515

 Example 3: > .pv_f(fv=100,r=0.1,n=1)  # meaning depend on keywords
            > .pv_f(r=0.1,fv=100,n=1)
            > .pv_f(n=1,r=0.1,fv=100)

              Note: The above three give the same result 

Well indented one
----------------
Objective: estimate present value
                     FV
formula used: pv= --------
                    (1+r)^n
pv : present value
fv : future value
r  : effective period rate
n  : number of periods
Example 1: > .pv_f(0.1,1,100)     # meaning of inputs depend on order
[1] 90.90909
Example 2: > .pv_f(0.045,5,225)
[1] 180.5515
Example 3: > .pv_f(fv=100,r=0.1,n=1)  # meaning depend on keywords
> .pv_f(r=0.1,fv=100,n=1)
> .pv_f(n=1,r=0.1,fv=100)
Note: The above three give the same result 
////////////////////////////////