How to declare these three with best practises and naming conventions
please respond quickly
thanks,
General Naming Conventions
- Descriptive Names: Variable names should be descriptive of their purpose or content.
- Camel Case: Common practice is to use camel case (e.g.,
myVariableName
). - Prefixes/Suffixes: Use prefixes or suffixes to denote the type or structure.
arrNumbers : Integer[]
lstNames : List(Of String)
dictEmployeeAges : Dictionary(Of String, Integer)
lstDataRows : List(Of DataRow)
arrDataTables : DataTable[]
<Sequence>
<!-- Array of integers -->
<Assign>
<arrNumbers>New Integer() {1, 2, 3, 4, 5}</arrNumbers>
</Assign>
<!-- List of strings -->
<Assign>
<lstNames>New List(Of String) From {"John", "Jane", "Doe"}</lstNames>
</Assign>
<!-- Dictionary of string to integer -->
<Assign>
<dictEmployeeAges>New Dictionary(Of String, Integer) From {{"John", 30}, {"Jane", 25}}</dictEmployeeAges>
</Assign>
</Sequence>
Hi @venkatasai
arrCustomerNames = New String() {"John", "Jane", "Doe"}
lstOrderIds = New List(Of Integer) From {101, 102, 103}
dictEmployeeDetails = New Dictionary(Of String, String) From {{"John", "Manager"}, {"Jane", "Developer"}}
Regards,
Hi @venkatasai
Generally we use the List, Arr, Dict for the Suffix of the variable name, For example,
List_VarName
Arr_VarName
Dict_VarName
Mainly we add suffix to it to identify quickly what is the datatype of Variable.
Hope it helps!!
Then how we can identity datatype of the particular Array,list,dict by looking at the name is it string or int
In that case we cannot identify weather it was List of String or List of int or Dictionary of String, Object. Generally we specify the variables names by using the conventions mentioned in the above response… @venkatasai
Hope you understand!!
Variable Names are the names which we store data either it is string,List ,arrays,Dictionary data.The variable names must be kept clearly or descriptively because when the new developer see the Code so he must understand what the variable contains.It should be descriptive because in projects we create 100 of variables we have to know what variable do what operation.So the variable Names must have some Standards when creating variables you have to follow Specifications.
When you create in Argument--->in_ArrNumbers
When you create out Argument---->out_ListNames
When you create Variables like string--->str_EmpName
Hope you understand my explanation
for example arry is string then by declaring we can use
Arr_var then but in ARR_var we cannot identify its datatype either string array or int array
For example i have Array of string
i am declaring like this is it ok
Arry_strnames this naming conventions comes under bpractice
We don’t mention the ArrStr_VarName like this the best practice is to follow the Arr_VarName that’s it… @venkatasai
If you want to specifically mention you can mention in the Tool tip for the variable in the Variable panel.
Go to Variables Panel → Right click on variable which you want to add tool tip → Select Design Properties then you can specify the tool tip like Array<String>
or Dict<String,Object> like this.
Check the below image for better understanding,
Hope it helps!!
It’s not come under Best Practice… @venkatasai
ok thanks for that but if we want the see its datatype we have to go the variables sections have to see variable type right?
its not possible to see the type of the var by its name
yes @venkatasai
If you want to specify in your variable you can, but it’s not a best practice. we also not recommend you that approach.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.