keywords
help--invokes the help system
help
help word
Help word
sends a word to the help system.
The word is looked up in the nrn/lib/helpdict file and if found
Netscape is sent the appropriate URL to display
the help text. If the word is not found, the URL for the table
of contents is sent. Netscape must be running for the help system
to work.
keywords
return
return expr
return
command will immediately exit from a procedure
without returning a value.
The return expr
command will immediately exit from a function
which must return a value. This command must also be the last executable
statement of a function. It is possible for a function to contain more
than one return
command, for instance in a series of if else
statements; however, not more than one of the return
commands may
return a value at any given time.
returns the maximum of two arguments which are read into the function. Eg.func max(){ if ($1 > $2){ return $1 } else { return $2 } }
max(3,6)
, where $1 is the
first argument (3) and $2 is the second argument (6). This use of max
would return the value 6.
keywords
break
section { statement }
or the stack will not be properly popped. Also it should not be placed on a line that contains object syntax but should be placed on a line by itself. eg.
should be writtenx.p() break
x.p() break
while(1) { x = fscan() if (x < 0) { break; } print sqrt(x) }
keywords
continue
prints the numbers: 1,2,3,4,5,7,8,9,10. 6 is left out because when i==6, the control is passed beyond the print statement to the next iteration of the loop.for i=1,10{ if(i==6){ continue } print i }
You can accomplish the same thing with the following syntax:
for i=1,10{ if(i<6 || i>6){ print i } }
keywords
stop
keywords
if (expr) stmt1
if (expr) stmt1 else stmt2
else
form, if the expression
evaluates to zero (false) stm2 is executed.
i = 0 //initialize i j = 0 //initialize j if(vec.x[i] <= 10 && i < vec.size()){ //if the value of the ith element in vec //is less than or equal to 10, and //if i is an index within vec vec1.x[j] = vec.x[i] //set the jth element of vec1 equal to that //ith element of vec i = i+1 //increment i by 1 j = j+1 //increment j by 1 } else{ //otherwise (This must be on the same line as the closing brace of //the previous statement in order to indicate that the compound //statement has not ended.) i = i+1 //simply go to the next element of vec }
keywords
keywords
while (expr) stmt
prints the cosines and the sines of thenumelements = 20 i = 0 while (i < numelements){ print(cos(vec.x[i])) print(sin(vec.x[i])) }
vec
elements up to numelements
, which in this case = 20.
keywords
for(stmt1; expr2; stmt3) stmt
for var=expr1, expr2 stmt
for (var) stmt
for (var, expr) stmt
for iterator (args) stmt
for
statement is similar to while
in that it iterates over
a statement. However, the for
statement is more compact and contains within its parentheses
the command to advance to the next iteration. Statements 1 and 3 may be
empty.
This command also has a short form which always increments the iterations by one.
is equivalent tofor var=expr1, expr2 stmt
However, expr1 and expr2 are evaluated only once at the beginning of thefor(var=expr1; var <= expr2; var=var+1) stmt
for
.
for (var) stmt
Loops over all segments of the currently accessed section. var begins at 0 and ends at 1. In between var is set to the center position of each segment. Ie. stmt is executed nseg+2 times.
for (var, expr) stmt
If the expression evaluates to a non-zero value, it is exactly equivalent
to
for (var) stmt
If it evaluates to 0 (within float_epsilon ) then the interation does
not include the 0 or 1 points. Thus for(x, 0) { print x }
is exactly equivalent to for (x) if (x > 0 && x < 1) { print x }
The iterator form of the for loop executes the statement with a looping construct defined by the user.
is equivalent tofor(i=0; i<=9; i=i+1){ print i*2 }
for i=0, 9 { print i*2 }
create axon access axon {nseg = 5 L=1000 diam=50 insert hh } for (x) print x, L*x for (x) if (x > 0 && x < 1) { print x, gnabar_hh(x) }
keywords
print expr, string, ...
printsx=2 y=3 print x, "hello", "good-bye", y, 7
and then moves to the next line.x hello good-bye 3 7
keywords
delete varname
keywords
read var
read var
will return 0 on
end of file and 1 otherwise.
will await input from the user or from a file, and will print the square of each value typed in by the user, or read from the file, for the first five values.for i=1, 5 { read x print x*x }
keywordsA toggle for parser debugging purposes. Prints the stack machine commands resulting from parsing a statement. Not useful to the user.
keywords
double var1[expr]
double var2[expr1][expr2]
double varn[expr1][expr2]...[exprn]
The index for each dimension ranges from 0 to expr-1. Arrays may be redeclared at any time, including within procedures. Thus arrays may have different lengths in different objects.
The Vector class for the ivoc interpreter provides convenient and powerful methods for manipulating arrays.
declares an array with 40 elements, whereasdouble vec[40]
creates a vector (which is an array by a different name) with 40 elements which you can manipulate using the commands of the Vector class.objref vec vec = new Vector(40)
keywords
em
This is a reasonably complete editor with many commands. These commands are listed in emacs.txt. A tutorial is also available at emacstut.txt
When called from the interpreter, the command ^C immediately returns to the interpreter and the current buffer is interpreted. Other commands follow:
keywords
depvar
prints the values of x, y and z.depvar x, y, z proc equations() { eqn x:: x + 2*y + z = 6 eqn y:: x - y + z = 2 eqn z:: 2*x + y -z = -3 } equations() solve() print x,y,z
keywords
eqn var:: expr = expr
eqn var: expr =
eqn var: = expr
makes the right hand side of the z equation "2 + 4y" and solves for the values x, y, and z.eqinit() depvar x, y, z proc equations() { eqn x:: x + 2*y + z = 6 eqn y:: x - y + z = 2 eqn z:: 2*x + y -z = -3 eqn z: = 5 + 4y } equations() solve() print x,y,z
keywords
local var
returns the number of elements which have the value of 7 in the first 40 elements offunc count() {local i, x x = 0 for i=0,40 { if (vec.x[i] == 7) { x = x+1 } } return x }
vec
. i
and x
are local variables, and their usage here will not affect variables of the same name in
other functions and procedures of the same program.
keywords
strdef stringname
will print to the screen:strdef a, b, c a = "Hello, " b = "how are you?" c = "What is your name?" print a, b print c
Hello, how are you? What is your name?
keywords
setpointer pvar var
would enable the synapse in soma1 to observe the axon2 membrane potential.soma1 syn1=new synp(.5) setpointer syn1.vpre, axon2.v(1)
keywords
insert mechanism
keywords
uninsert mechanism