I have encountered some unexpected behavior when assigning a variable in an if statement. Consider the following minimal working example, which checks to see if a variable was passed via a -c command line argument:
Code: Select all
print name_declared("myparam")
if (name_declared("myparam")!=5) {
print "Case 1"
myparam = 3
} else {
print "Case 2"
}
Code: Select all
0
Case 2
Code: Select all
0
Case 1
I am running NEURON "VERSION 7.3 ansi (1078:2b0c984183df) 2014-04-04", compiled from source using the "--with-nrnpython" and "--paranrn" compiler flags on GNU/Linux x86_64, 3.2.0-29-generic.