Index() function or Index by the dot in a variable (Example: local!user.name)

Certified Associate Developer
Is there an advantage one over the other? In my current project, using the index with the dot is questioned as bad practice, requesting to always use the index() function, my question is, is this really necessary? what are the reasons? I understand that sometimes it is good to control the default value and set a null.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    You can use both index() or property() functions. dot notations or the square brackets can be used for at your saveInto. But prefer index() if an array or property to get the properties. But it depends on your use case as well. Bottom line dot notation cannot handle null exceptions well and using property or the index() function will help you set a null exception.

Reply
  • +1
    Certified Senior Developer

    You can use both index() or property() functions. dot notations or the square brackets can be used for at your saveInto. But prefer index() if an array or property to get the properties. But it depends on your use case as well. Bottom line dot notation cannot handle null exceptions well and using property or the index() function will help you set a null exception.

Children
No Data