# How does inline "case" work?

## Recommended Posts

I'm trying to set the value of a G:var based on the value of another, as in:18 (>G:Var1)1 2 8 10 11 12 15 16 18 19 20 11 (G:Var2) case 0 (>G:Var2)181 183 184 185 193 197 0 7 (G:Var2) case 18 (>G:Var2)But this obviously doesn't work:(. I'm trying to set the value of G:Var2 to either 0, if G:var1 = the one of the first set of values, or 18 if it's one of the second sets of values.Can anyone show me how the syntax would work for this?Thanks,--Jon

#### Share this post

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

Hi,Probably this works too:(G:Var1) 20 <= if{ 0 (>G:Var2) } els{ 18 (>G:Var2) }Jan"Procul Negotiis"

#### Share this post

##### Share on other sites

If you look in xmlgau01.zip you'll find the case syntax a bit explained.It is first the values you want to get out of the case, then the numbers of entries, then the value the case depends on, then "case":e.g. setting G:Var2 depending on G:Var11 2 8 10 11 12 15 16 18 19 20 11 (G:Var1) case (>G:Var2)"1 2 8 10 11 12 15 16 18 19 20" are the values to set, these are 11 items, it depends on G:Var1, after the case you have the "cased" values, which can be written to G:Var2. Note the output can be quite reversed, I assume if G:Var1 is 0 the returned value is 20, 1->19,...,10->1. If you want it reversed, reverse the values.Arne Bartels

#### Share this post

##### Share on other sites

Ah yes thanks, it was the output values that were stumping me. I was able to adjust the thing accordingly.Thanks again!--Jon

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• 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!

Click here for more information and to see all donations year to date.
• ### Donation Goals

AVSIM's 2018 Fundraising Goal

Donate to our annual general fund. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.

\$19,365.00 of \$36,000.00 goal reached.
Donate Now