if elseif elseif else in netlogo
functional-programming, if-statement, netlogo
Solution
You only want to pick one random number, not several. You can use `let` to store the random number so you can refer to it later. So:
let chance random 100
ifelse chance < 68
[ set HBB-Genes "A,A" ]
[ ifelse chance < 70
[ set HBB-Genes "S,S" ]
[ ifelse chance < 85
...
And so on.
Problem
I want to have a if elseif else if else structure in netlogo but it seems that at the moment it is not working. ``` ifelse random 100 < 68 [ set HBB-Genes "A,A" ];;68% [ifelse random 100 < 2 [set HBB-Genes "S,S"] ;;2% [ifelse random 100 < 15 [set HBB-Genes "A,A"];;15% [set HBB-Genes "A,A"] ;;15% ]] ``` I would like to have a 68% chance of occurring the set HBB-Genes with "A,A" and the next one with 2% chance of occurring and so on. If anyone has experience with netlogo and can help it will be much appreciated. Thanks.