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
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
Share Improve this question asked Feb 2 at 19:21 YopeYope 872 silver badges7 bronze badges 1- While this is a valid question and Felipe'Ss answer is top-notch, can I also refer you to the great AnyLogic help which often solves such questions immediately: anylogic.help/library-reference-guides/process-modeling-library/… But always feel free to ask, just remember that there is also a good help out there :) – Benjamin Commented Feb 3 at 6:17
1 Answer
Reset to default 1Option 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;