passing parameters to the function

Hello;I am getting errors while passing parameters to the function. I amsuresomeone here knows the answer -this works -q)i:0q)a:worksq)while[i \< 5; s,: { ( { [d;w;c] :d,w,c } [x;a;i] ) } peach2010.01.05 + til 2; i+: 1]q)s2010.01.05 works 02010.01.06 works 02010.01.05 works 12010.01.06 works 12010.01.05 works 22010.01.06 works 22010.01.05 works 32010.01.06 works 32010.01.05 works 42010.01.06 works 4q)but when I try to put same thing in a function it does not workq)myf:{ [] j:0; b:doesnotwork; while[j < 5; s1,:{ ( { [d;w;c] :d,w,c } [x;b;j] ) } peach 2010.01.05 + til 2; j+:1]; :s1 }q)myf{( { [d;w;c] :d,w,c } [x;b;j] ) }'jq))Thanks in Advance,RT

b and j are out of scope.

For your example, fix them with a projection

q)myf:{j:0;b:`doesnotwork;while[j<5;s1,:{({[d;w;c]d,w,c}[x;y;z])}[;b;j]pe=
ach
2010.01.05+til 2;j+:1];s1}

Charles,

Thanks, It worked.

Ragards,
RT