Set a variable to two different values Topic is solved
Set a variable to two different values
I want to make a script for a card game in which an Ace equals 1 or 11. The only thing I can think to do is have a variable, call it "Ace," and set it equal to 1 and/or 11; however, I can't figure out how to do this... I can make Ace:=1 or Ace:=11, but not Ace:=1 or 11. How would I go about this? Would there be a better method?
Re: Set a variable to two different values Topic is solved
what about an array
If Ace must equal either 1 or 11 based on "some other factor" you could use ternary something like thisIf this a static string manipulation, you could simply go
Code: Select all
Ace := [ 1, 11 ]
msgbox % Ace.1 " or " Ace.2
Code: Select all
SomeOtherFactor := 1
Ace := ( SomeOtherFactor = 1 ) ? 1 : 11
msgbox % Ace
Ace := ( SomeOtherFactor = 0 ) ? 1 : 11
msgbox % Ace
Code: Select all
Ace := 11
msgbox % SubStr( Ace, 1, 1 ) " or " Ace
Re: Set a variable to two different values
Thanks, that's more than I could have asked for
Who is online
Users browsing this forum: divanebaba, dunnerca, garry, Google [Bot], StupidIdiotMoron and 149 guests