Arrays are kinda new to me,… but they seem great.
Question:
I made an array
montharray = [“jan”,“feb”,“mar”,“april”,“may”,june",“juli”,…etc]
–> 12 months.
then I have a variable
var month.
Suppose month == “feb”, then --> month = 2 (the index value+1 of “feb” in my array).
if month == “mar”, then the month-value changes to 3,
etc…
I was just about getting there myself (figured the loop thing out :-)… and the result looks similar to what you guys have written.
Thanks David and Cyanblue…great to see I’m getting the hang of this…
Say David…
why do u use " return(month); " in your function ? Just wondering… i’ve never used ‘return’
you’ve set month = i;
Why add another line of code?
I figured that, though this function might not be what you were looking for specificaly, that it might give an indication of different things that can be done that you might not know of.
To tell the truth, I have no clue if my script does what I was thinking it would do.
ie
month=3;
call to function retMonthVal(month);
the place where you were calling that from would now have month set to “april”.
Like I said… I’m not even posative that it would do that.
In general, return is used to send data back to whatever script was calling the funtion, to continue on it’s own objectives.
It was exactly what i was looking for. I only used the for(…) loop part, without the function. And month needed to be i+1 (januari becomes 1, februari 2, etc…)