Home > DeveloperSection > Forums > Cant understand a syntax in vbscript
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    June-20-2013 1:52 AM

 VB Script VB Script 
Ratings:


 1 Reply(s)
 771  View(s)
Rate this:
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


Vijay Shukla

Total Post:100

Points:700
Posted on    June-20-2013 5:23 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick