# Problem with IF

## Recommended Posts

Sorry for my English!I have a problem with IF condition.I have a variable (L:hdcrs, number) and :if (L:hd, number) < 0 then (L:hd, number)=(L:hdcrs, number)+2*piif (L:hd, number) > (2*pi) then (L:hd, number)=(L:hdcrs, number)-2*piif (L:hd, number) is greater 0 but less of (2*pi) (L:hd, number)=(L:hdcrs, number)Please me a solution!Thank Piermario

##### Share on other sites

(L:hd, number) 0 < if{ (L:hdcrs, number) 6.283185 + (>L:hd, number) } els{ (L:hd, number) 6.283185 > if{ (L:hdcrs, number) 6.283185 - (>L:hd, number) } els{ (L:hd, number) (>L:hd, number) } }you may want to change units from number to enum. IIRC numbers = whole numbers, enum = numbers and decimal.Little rusty, but that should do it, hope it helps. Regards,Roman

##### Share on other sites

Hi,A basic solution (simple if/else code) :(L:hd, number) 0 < if{ (L:hdcrs, number) 2 pi * + (>L:hd, number) }els{ (L:hd, number) 2 pi * > if{ (L:hdcrs, number) 2 pi * - (>L:hd, number) } els{ (L:hd, number) 0 > (L:hd, number) 2 pi * < and if{ (L:hdcrs, number) (>L:hd, number) } } }Tom

##### Share on other sites

After looking at the original code a light bulb went off...see - http://blogs.technet.com/engauged/archive/...f-a-bugger.aspxso for your code use - (L:hdcrs, number) rddg dnor dgrd (>L:hd, number)all fixed :-)Regards,Roman

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!