anylogic

How do I make an if statement within the select output block in anylogic?


How do I make an if statement within the select output block in anylogic? So if p_value is 1 it should go to the "true" output. Using this syntax as I want to make a more complicated if-then-else statement.

Filling this text is here to ensure that I can post this post enter image description here


Solution

  • Option 1:

    agent.p_value==1
    

    Option 2

    agent.p_value==1 ? true : false
    

    Option 3 checkTrue() and you create a function called checkTrue that returns a boolean

    if(agent.p_value==1) return true; else return false;