Thread: Simple Safe
View Single Post
  #17  
Old 10-16-2008, 05:15 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Kristi View Post
Um, what? There is nothing wrong with consecutive if statements if the situation calls for it. It should never error, unless you are referring to a lack of end if/end/fi/whatever (which is a minority of languages)

This is valid php code that is necessary to use two consecutive ifs to do what it needs to do (granted it is pointless)
I elaborated on what I meant and gave examples using Java in the previous page. No point on reiterating my explanation, I'm just going to assume that you didn't look at it?

Quote:
Originally Posted by Kristi View Post
Um, why? Absolute value? He should just give an error message for anything less then 0 and that is it.
It's a mode of preference, so there shouldn't be an argument because both ways could work without tampering efficiency. Without the absolute value, the script would reject negative values, so if you simply converted the negative values to positive values, then you'd save yourself having to check for only positive numbers.

If the script prompted the user to verify the amount that they are donating/withdrawing, then this wouldn't be a problem, since they could simply reject to donate/withdraw the amount if they entered, say, -5, and the script read it as 5.

Since there should be a verification bit, it would save you a check in the end since you wouldn't have to do if (whatever >= 0), since whatever will always be greater than or equal to 0.


In the end, it depends on how you want to do it.
Reply With Quote