L=1.0 ;
Ii=10;
Nn=20;
h=2L/Ii;
u=1;
dt=h;

q0[x_]:=If[x>-0.3 && x <0.3,1,0]
f[q_]:=u*q
F[a_,b_]:=
Return[f[a]]
(*Module[{aa,bb},
If[D[f[aa],aa]>0/.aa->a && D[f[bb],bb]>0/.bb->b,f[a]];
If[D[f[aa],aa]<0/.aa->a<0 && D[f[bb],bb]<0/.bb->b,f[b]]
]*)

Plot[q0[x],{x,-L,L}]

grid=Range[-L,L,h]

Q[0]=Table[q0[grid[[i]]],{i,1,Length[grid]}]

Do[
Q[n+1]=Flatten[
Join[{0,Table[
Q[n][[i]]-dt/h(F[Q[n][[i]],Q[n][[i+1]]]-F[Q[n][[i-1]],Q[n][[i]]])
,{i,2,Length[grid]-1}],
0}]]
,{n,0,Nn}]

Animate[ListLinePlot[Transpose[{grid,Q[t]}]],{t,0,Nn,1}]