"Integrate gives the analytical solutions"
f[x_]:=Exp[x]−x−2;
Integratef[x_]:=Integrate[f[x],x];
Plot[f[x],{x,-1,1}]
Print["f[x]=",f[x]];
Print["Integratef[x]=",Integratef[x]];

"Let's integrate f[x] = Exp[x] -x -2 from x0=-1 to x1=1."
x0=-1;x1=1;
"Analytically, integrating f[x] from x=x0= to x=x1 is given by Integratef[x0]-Integratef[x1]"

"What is the value of Integratef[x0]?"
Integratef[x0]

"It wouldn't print out the value. The correct way to do this is by using the 'substitute' command, /. "

Integratef[x]/.{x->x0}

"To obtain the numerical value of Integratef[x]/.{x->x0}, use the command N"
N[Integratef[x]/.{x->x0}]

"Hence, now we can use Mathematica's Integrate to calculate the exact value of the definite integration, (∫_(x0 = -1)^(x1 = 1))(Exp[x]−x−2) \[DifferentialD]x, based on analytical expression. It is given by 
N[Integratef[x]/.{x->x1}]-N[Integratef[x]/.{x->x0}]:"

Print["N[Integratef[x]/.{x->x1}]=",N[Integratef[x]/.{x->x1}]];
Print["N[Integratef[x]/.{x->x0}]=",N[Integratef[x]/.{x->x0}]];
Print["N[Integratef[x]/.{x->x1}]-N[Integratef[x]/.{x->x0}]=",N[Integratef[x]/.{x->x1}]-N[Integratef[x]/.{x->x0}]];

"Now, we can use NIntegrate to do the integration. This way of evaluating the integration is by way of numerical integration. It is less 'superior' then the analytical way. But if the numerical integration is correctly done, it should return a value as calculated by way of analytical expression."
"NIntegrate[f[x],{x,x0,x1}]="
NIntegrate[f[x],{x,x0,x1}]

"We find that the integration value ontained using NIntegrate and that obtained via taking the difference of the Integratef between x1 and x0 are the same, which is what we expect."

"Note that Integratef[x0] which is defined as F[x]=(∫_c^x)(Exp[x]−x−2) \[DifferentialD]x, where c is any arbitrary value, is known as antiderivative of the function f[x]=Exp[x]−x−2.  The definite integration between two limits, x0, x1, (∫_x0^x1)(Exp[x]−x−2)dx, is given by F[x1]-F[x0]. This is known as the fundamental theorem of calculus. Recall your Calculus ZCA 110."