BBC BASIC
« IF..THEN..ELSE Problem »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 4:22pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: IF..THEN..ELSE Problem  (Read 219 times)
RNBW
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 23
xx IF..THEN..ELSE Problem
« Thread started on: Mar 27th, 2017, 7:24pm »

Why do I get "Missing END IF" error at the first END IF in the following code:

Code:
      z=0: a=0: c=0: rl=0: rr=0: vk=0
      rl = 10: rr = 15
      a = 10: c = 0
      z = 5

      IF z < a THEN
        vk = rl
      ELSE IF z > a + c THEN
          vk = -rr
        ELSE
          vk = 0
        ENDIF
  
        PRINT vk
 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: IF..THEN..ELSE Problem
« Reply #1 on: Mar 27th, 2017, 9:36pm »

on Mar 27th, 2017, 7:24pm, RNBW wrote:
Why do I get "Missing END IF" error at the first END IF in the following code

The unhelpful (but accurate) answer is because the ENDIF is missing! Apart from doing a simple count (there are two multi-line IF statements but only one matching ENDIF statement) it's evident from the indentation that the first ('outer') IF clause is never terminated.

But presumably that's not the answer you wanted since it's stating the obvious, so what is it that you really want to know? Is the question related to the recent Cascaded IF clauses and the semicolon thread?

Richard.
User IP Logged

RNBW
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 23
xx Re: IF..THEN..ELSE Problem
« Reply #2 on: Mar 27th, 2017, 10:17pm »

Hi Richard

No, I just didn't see that I'd missed an ENDIF. Should have because of the alignment.

However, thank you for bringing the semi-colon issue to my notice. If I'd seen that at the time, the examples would have made it obvious to me.

Thanks for the help.

Ray
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls