19 Replies
Im making it wher i cant use negitives
im new so any help would be nice
what is the value of Program.balance
1000
and what happen when you substract
-1000
from 1000
like 1000 - (-1000)
?PasteCode
test5555 - PasteCode.dev
PasteCode.dev is a website where you can store any code online for quick sharing. You can paste code and share code online for free.
what is the value of
1000 - (-1000)
?this?
i mean just solve simple math question and you will understand, what is
1000 - (-1000)
2000
yes, which means that
NewBalance
now has a value of 2000
and when you check if 2000 <= 0 it will be false
if I understood what you want to accomplish you should change if(NewBalance <= 0)
to if(withDrawl_Ammount <= 0)
omg
im dumb sorry
im now understanding
i got another Q for u
what am i doing wrong here for math
cause i need it to add to my orignal balence
You're returning from the method on this line which causes the rest of the method to never get executed
Besides that, you're not check if depositAmount is negative or not
You're only checking if adding the deposit amount with the
Program.balance
causes Program.balance
to be lower than or equal to zero
So if your Program.balance
is 1000 and your depositAmount
is -10
Program.balance
is 990soo just remove the =
in <=
?
also how do i make it add still the Program.balence still says 1000
im bad at math
oh nvm
i needed to swap program.balence abd newBalenceDepo var
this isnt python - if you skip the braces after an
if (...)
only the next statement is conditional
so that return;
Kouhai pointed out isnt conditional - it always runsUnknown User•4mo ago
Message Not Public
Sign In & Join Server To View