mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-31 18:05:14 +02:00
The syntax is listed in the ngspice manual, chapter 17.6 Control Structures. Practical examples using a simple voltage divider circuit are given here.
20 lines
302 B
Plaintext
20 lines
302 B
Plaintext
example if then else loop
|
|
.control
|
|
|
|
foreach val -40 -20 0 20 40
|
|
if $val < 0
|
|
echo variable $val is less than 0
|
|
else
|
|
echo variable $val is greater than or equal to 0
|
|
end
|
|
end
|
|
|
|
let vec = 1
|
|
if vec = 1 ; $&vec = 1 is possible as well
|
|
echo vec is $&vec
|
|
end
|
|
|
|
.endc
|
|
|
|
.end
|