Anyone can Explain why we are using comma(,) at end of the code?

Where we can use comma where we canot use comma?

  Discussion posts and replies are publicly visible

  • It is just to use the separator for vairables and functions in the code. Like we have semicolons and other charecters in the different programing languages. This is how the program reads each step of the code and will execute it in the same way.
  • 0
    Certified Lead Developer
    Commas in Appian almost always are used for separating items in a list, so Appian will know you've moved on to the second item; or more crucially, commas are used to separate inputs to a function, so Appian will know you've moved on and you're referring to the next input.

    Let's have hypothetical function A. Your code could look like this:

    function A(
    input1: "this is my first input"
    input2: "this is my second input"

    and Appian is left to assume {"this is my first input" input2: "this is my second input" } is what you intended to put in the first input of function A. It doesn't understand what to do with this. You put a comma, and it starts looking for the definition of the second input, and it understands. When you don't use keywords for passing inputs, there's no other way for it to know than assume first comma is the end of first input, second comma is the end of the second, and third comma is the end of the third. Comma is the signal for Appian to start looking for the next input, so you don't put a comma after the last one.

    I hope I have explained this well.
  • 0
    Certified Lead Developer
    Hi Tiru,

    We use Comma in Appian to separate the statements. So that Appian can differentiate and convert the code .We dont use comma after the last line of the statement, so that Appian understand that we reached to the end of that block.

    a!textField(
    label:"FirstName",
    placeholder:"Your First Name",
    saveInto:{},
    validations:{}
    ),
  • It is just to use the separator for vairables and functions in the code. Like we have semicolons and other charecters in the different programing languages.