Re: [Ql-Users] Fw: Stupid AND
Well, no it wasn't. And we're all kids of the 80s. Hit us up :D On Thu, Sep 21, 2017 at 1:41 PM, Ralf Reköndt via Ql-Users < ql-users@lists.q-v-d.com> wrote: > Sorry, was private ;-)) > > > > Am 21.09.2017 um 20:40 schrieb Ralf Reköndt: > >> Hi Dilwyn, >> >> after a very long time, I need again your help in identifying a song >> text. No need to hurry, if you ever get the time. I think, you may have >> heard this one in the 80s. >> >> Thank you. >> >> Cheers...Ralf >> > > ___ > QL-Users Mailing List > -- Dave Park d...@sinclairql.com ___ QL-Users Mailing List
Re: [Ql-Users] Fw: Stupid AND
Sorry, was private ;-)) Am 21.09.2017 um 20:40 schrieb Ralf Reköndt: Hi Dilwyn, after a very long time, I need again your help in identifying a song text. No need to hurry, if you ever get the time. I think, you may have heard this one in the 80s. Thank you. Cheers...Ralf ___ QL-Users Mailing List
Re: [Ql-Users] Fw: Stupid AND
Hi Dilwyn, after a very long time, I need again your help in identifying a song text. No need to hurry, if you ever get the time. I think, you may have heard this one in the 80s. Thank you. Cheers...Ralf ___ QL-Users Mailing List
Re: [Ql-Users] Fw: Stupid AND
yes, that's of course the right (and long-winded) way to do it, and I always remember that ... once my program has crashed. Wolfgang I know the feeling... :-) Dilwyn . ___ QL-Users Mailing List
Re: [Ql-Users] Fw: Stupid AND
Hi, yes, that's of course the right (and long-winded) way to do it, and I always remember that ... once my program has crashed. Wolfgang through splitting up and building up to the final logcal value. The easiest way around this simple example is using two IFs instead of AND to ensure (b/a) is never executed (or am I missing something here?) 10 a=0 20 b=10 30 IF a<>0 35 IF (b/a)=5 40 do_something 50 END IF 60 END IF I agree though, the way you would like it to work would obviously be better. Dilwyn -Original Message- From: Wolfgang Lenerz via Ql-Users Sent: Tuesday, September 19, 2017 8:27 PM To: ql-us...@q-v-d.com Cc: Wolfgang Lenerz Subject: [Ql-Users] Stupid AND Hi all, Just a rant about the SBasic AND operator. Suppose this: 10 a=0 20 b=10 30 if (a<>0 AND b/a=5) 40 do_something 50 end if Run it and what happens? You get an "overflow" error at line 30. You get this error because it is trying to evaluate the second condition (b/a) and failing as a=0 and you can't divide by 0. BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. Apparently though, Sbasic still also tests the second condition. G. Wolfgang ___ QL-Users Mailing List --- This email has been checked for viruses by AVG. http://www.avg.com . ___ QL-Users Mailing List ___ QL-Users Mailing List
[Ql-Users] Fw: Stupid AND
I take the point about other basics doing it differently, but this is how Sinclair BASIC has worked, by building up a value for the overall expression through splitting up and building up to the final logcal value. The easiest way around this simple example is using two IFs instead of AND to ensure (b/a) is never executed (or am I missing something here?) 10 a=0 20 b=10 30 IF a<>0 35 IF (b/a)=5 40 do_something 50 END IF 60 END IF I agree though, the way you would like it to work would obviously be better. Dilwyn -Original Message- From: Wolfgang Lenerz via Ql-Users Sent: Tuesday, September 19, 2017 8:27 PM To: ql-us...@q-v-d.com Cc: Wolfgang Lenerz Subject: [Ql-Users] Stupid AND Hi all, Just a rant about the SBasic AND operator. Suppose this: 10 a=0 20 b=10 30 if (a<>0 AND b/a=5) 40 do_something 50 end if Run it and what happens? You get an "overflow" error at line 30. You get this error because it is trying to evaluate the second condition (b/a) and failing as a=0 and you can't divide by 0. BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. Apparently though, Sbasic still also tests the second condition. G. Wolfgang ___ QL-Users Mailing List --- This email has been checked for viruses by AVG. http://www.avg.com . ___ QL-Users Mailing List