IF THEN ELSE nested statement system dynamics command in NetLogo

765 views Asked by At

I have variables in system dynamic in NetLogo and I am trying a nested if else as follows

Md * (( ifelse n_porg = 0 [ 0 ] [ ifelse ( ( SDIa * Total_norg ) / n_porg ) > 1 
       [ 1 ] [ ( SDIa * Total_norg ) / n_porg ] ] ) / delay ) 

I am getting an error "Expected reporter" please help

1

There are 1 answers

0
Seth Tisue On

ifelse is a command; you can't drop a command into the middle of a reporter expression, because a command doesn't report a value.

Instead of ifelse, use ifelse-value, which is a reporter.

You may find you need to add parentheses, e.g. ifelse (n_porg = 0) ...