I’m making a borrow system,
I got a text and when i click “borrow”
- set the virable “ifBorrow” to “true”
- call “check name and number function”
(i also have giveBack button, so check name and number not only for borrow) - in the function, if the name is empty, then alert errorA
- in the function, else if the number is less then 1, alert errorB
- in the function, else if the number we want to borrow more then we have, alere errorC
I try as following but something wrong :
if i didn’ select name, alere errorA -> it’s correct
else if i input 0, alert errorB -> it’s correct
then something happaned, now i set the number we have is 2
when i input 3 to the text
the system will alert errorB, then i click the button again without change anything,
the system alert errorC, always the second time,
but when i change the input to 0,
the system alert errorB again at the frist time,
then i make a new alert to check the input,
the first time whe i input 3, the check alert show the input is 3,
but the system still alert errorB, and the second time will be correct alert errorC
i don’t know what happened…