Code

Code

10Dulkar
Not applicable
413 Views
2 Replies
Message 1 of 3

Code

10Dulkar
Not applicable

[ FlexSim 21.2.2 ]

i was going through one model on Time table and i saw a code there, which i dont know how to read in FlexScript. can someone elaborate what does the following code does and and what is the meaning of keywords and symbols used in it.

return /**/token.Shift == 1 ? token.Day + 1 : token.Day/**direct*/;


what is the meaning of "?" and ":" in the above code.


0 Likes
Accepted solutions (1)
414 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

It is a ternary operator. See Writing Logic in FlexSim and ?: - Wikipedia

It is a shortcut way to write an if/else statement in one line.

In that code, if token.Shift == 1, then it will return token.Day + 1, otherwise it will return token.Day.

/**/ and /**direct*/ are commentary markup statements used by the popup GUI.



Phil BoBo
Sr. Manager, Software Development
Message 3 of 3

10Dulkar
Not applicable
this is great. thank you. I will check out the writing flexsim logic with more attention. 🙂
0 Likes