Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Posted: 18 Feb 2013 at 10:21am
basically on the det field if it is an E then amount field needs to remain the same and if det is D then amount needs to be the opposite of sign ie negative if it's positive and vice versa.
the same logic would apply to last two if statements.
Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Posted: 19 Feb 2013 at 4:02am
it absolutely works! i was piecing this together as your email came across and it looks like they both do the same thing. although i like your code better as it's cleaner.
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 19 Feb 2013 at 4:14am
And you don't need the variable - you could just put the value that you want to return after the colon and then do a final case of True that returns the zero. It's probably not that big a deal except that variables add a bit of processing overhead so it's better to avoid using them if you don't specifically need them.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum