LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathscript Syntax Error

Solved!
Go to solution

Can anyone let me know what the syntax error is in this

 

 

if((A>=1.70)&(A<=1.71))
A=1
if((A>=1.34)&(A<=1.36))
A=1
if((A>=0.925)&(A<=0.935))
B=1
if((A>=1.305)&(A<=1.32))
B=1
if((A>=1.935)&(A<=1.941))
C=1
if((A>=1.72)&(A<=1.73))
D=1
if((A>=1.70)&(A<=1.71))
E=1
if((A>=1.65)&(A<=1.66))
F=1
if((A>=1.29)&(A<=1.30))
G=1
if((A>=1.0)&(A<=1.05))
H=1
else
I=1
end

 

thanks chris

0 Kudos
Message 1 of 5
(2,862 Views)
Solution
Accepted by topic author chrisharris

I assume you want all of those if's (except the first one) to be an elseif.  If this is not the case, then you want to put an end after each individual if.

 

Also, it's not a bad idea to throw a ; at the end of each statement.  (Not the lines containing if, elseif or end)

 

Also, you probably want to use && instead of &.  I'm not sure if mathscript differentiates between the two, but I know some languages do.  The help file for mathscript uses &&, so I'd go with that.  Anyone care to confirm if there's a difference?

Message Edited by elset191 on 05-07-2010 10:19 AM
--
Tim Elsey
Certified LabVIEW Architect
Message 2 of 5
(2,849 Views)

Thanks for your help with this,the coding now works. Also && works as well but I think a single & also works.

 

Thanks

 

Chris

0 Kudos
Message 3 of 5
(2,841 Views)

Some information about the difference between the & and && operators is presented in this thread.

Grant M.
Senior Software Engineer | LabVIEW MathScript | National Instruments

Message 4 of 5
(2,829 Views)
Thanks for the link, that's some good info.
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 5 of 5
(2,819 Views)