Syntax error

Use this forum to post Vensim related questions.
Post Reply
nesfehani
Junior Member
Posts: 2
Joined: Fri Oct 13, 2017 11:21 am
Vensim version: PLE

Syntax error

Post by nesfehani »

Hi,
I am writing the code which has nested IF THEN ELSE but unfortunately I get syntax error (attached you can find the image including the code and the error). I have checked the parenthesis and commas but could not find where the problem is.
your kind help is really appreciated.
Attachments
ERROR.jpg
ERROR.jpg (332.58 KiB) Viewed 1214 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Syntax error

Post by Administrator »

You cannot have 1<time to detect errors<2. Instead, use
if then else ( 1 < time to detect errors :and: time to detect errors < 2 , ......

A couple of notes as well. Nesting if then else statements is bad practice, it makes it difficult to debug. Embedding numbers in equations (such as the 1, 2 and 3 in your equation here) is also bad practice. It would be better to create a constant and put the number in there so at least someone looking at your model knows exactly what the 1, 2 and 3 are.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Post Reply