
-----------------------------------
david92ng
Fri Oct 26, 2007 7:46 pm

Subracting a varaible from an other varaible
-----------------------------------
Hey,

lets say we have a code like this:

var money : real
var bet :real

so..... I declared it but I don't know how to subtract the bet from the ammout of money.
If you havnt figured it out yet, im makeing a card game.

Im looking for a code something like this:

money := money - bet

but everyone here knows this wont work... LOL but you get my idea rite?

Any suggestions? or is there a better way of doing this?
Thanks, asap is good

-----------------------------------
david92ng
Fri Oct 26, 2007 7:47 pm

Re: Subracting a varaible from an other varaible
-----------------------------------
ummm... yea... im kinda new to turing

-----------------------------------
SNIPERDUDE
Fri Oct 26, 2007 8:56 pm

Re: Subracting a varaible from an other varaible
-----------------------------------
Ummm, no.  I don't get what you mean, you will have to be more specific...

-----------------------------------
rdrake
Fri Oct 26, 2007 9:26 pm

RE:Subracting a varaible from an other varaible
-----------------------------------
money -= bet
...?

-----------------------------------
CodeMonkey2000
Fri Oct 26, 2007 9:27 pm

Re: Subracting a varaible from an other varaible
-----------------------------------

money := money - bet
but everyone here knows this wont work... LOL but you get my idea rite?


That code will work. But money and bet need to be assigned a value first.

-----------------------------------
Nick
Fri Oct 26, 2007 9:38 pm

RE:Subracting a varaible from an other varaible
-----------------------------------
well ur code will work but there is a better way to do it and rdrake has got it

the money-=bet will act as tho u said money:=money - bet  also there is += which is money:=money + bet and also ~= which is not = of money:= money not= bet (usually used for boolean varibles

but what u are looking for is the -= (and possibly += if they win the hand) this is how it will look

var money:real
var bet:real

%assign bet and money to a value
money:=1000
put "How much will you bet?"
get bet

money-=bet

%some code here

if win then
   money+=bet
end if

-----------------------------------
david92ng
Fri Oct 26, 2007 10:18 pm

Re: Subracting a varaible from an other varaible
-----------------------------------
ah thanks, thats exactly what im looking for. like my old code didnt subtract as the output. i think i know why now. thanks for all your help guys.
