mmoohhaammaadd
Programmer
I want to input a vector "a" (or matrix) to a procedure and do some algebraic operations with its elements:
set a(1) 2;
set a(2) 3;
proc mult {a} {
global b
set b [expr $a(1)*$a(2)]
}
mult $a
puts "$b"
when I run this script it says:
can't read "a": variable is array
can anyone help me and write the correct procedure for this purpose?
set a(1) 2;
set a(2) 3;
proc mult {a} {
global b
set b [expr $a(1)*$a(2)]
}
mult $a
puts "$b"
when I run this script it says:
can't read "a": variable is array
can anyone help me and write the correct procedure for this purpose?