Cant understand a syntax in vbscript

Hi Guys,

I know its a really stupid question, but can anyone help me understanding these lines:

dim dmnth = array()
Redim dmnth(Rs_emp_count + 1, Rs_proj_count + 1, total_days + 1)
dmnth(emp_cnt, prj_cnt, 0) = pname & " (" & pid & ")"

Thanks
Last updated:6/20/2013 5:23:54 AM

1 Answers

Vijay Shukla
Vijay Shukla

Hi,


dim dmnth = array(); this sets dmth to the return value of the function array(); whatever that is. It is an unnecessary step in your program; unless array() does something useful aside from returning a value back.

Redim dmnth(Rs_emp_count + 1, Rs_proj_count + 1, total_days + 1); this trashes the contents of dmth; replacing dmnth with a 3D array with sizes, for each dimension respectively, Rs_emp_count + 1, Rs_proj_count + 1 and total_days + 1. All elements are cleared.

dmnth(emp_cnt, prj_cnt, 0) = pname & ' (' & pid & ')' assigns pname & ' (' & pid & ')' to the (emp_cnt, prj_cnt, 0) element of the array. Remember that arrays in VBScript are zero based; i.e. (0, 0, 0) is a valid element.

Answer