Thread: Can you count to ten?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    BBC Basic

    Code:
    REM 1-10 printing
    REM written by Ada Skyla-Rose
    REM ===================
    FOR i = 1 TO 10
    PRINT i
    NEXT i
    ENDPROC
    END
    Double Helix STL

  2. #2
    Registered User
    Join Date
    Oct 2016
    Location
    Wales, UK
    Posts
    12
    Quote Originally Posted by swgh View Post
    BBC Basic

    Code:
    REM 1-10 printing
    REM written by Ada Skyla-Rose
    REM ===================
    FOR i = 1 TO 10
    PRINT i
    NEXT i
    ENDPROC
    END
    This won't run in BBC BASIC since you haven't defined the procedure. Remove the ENDPROC and it will work - or define the procedure. This will work in BBC BASIC for Windows:

    Code:
          PROC_loop
          PRINT
          PRINT "THE END."
          END
         
          DEF PROC_loop
          FOR I=1 TO 10
            PRINT I;
          NEXT I
          ENDPROC
    ...as will the REPEAT...UNTIL loop in BBC BASIC that I posted earlier on in this thread.

  3. #3
    Registered User
    Join Date
    Oct 2016
    Location
    Wales, UK
    Posts
    12
    May as well add the WHILE...ENDWHILE loop way of doing this in BBC BASIC

    Code:
          
          REM WHILE...ENDWHILE loop BBC BASIC (BBC BASIC for Windows & BBC BASIC V)
          a%=0
          WHILE a%<10
            a%+=1
            PRINT a%
          ENDWHILE
          END

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Uppercase/Lowercase/Word COunt/Char count
    By Charak in forum C Programming
    Replies: 7
    Last Post: 02-23-2011, 08:16 AM
  2. Even I Can Count Better Than That...
    By pianorain in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 12-02-2005, 07:17 PM
  3. Again Character Count, Word Count and String Search
    By client in forum C Programming
    Replies: 2
    Last Post: 05-09-2002, 11:40 AM
  4. Replies: 2
    Last Post: 05-05-2002, 01:38 PM

Tags for this Thread