basics programming


Results 1 to 4 of 4

Threaded View

  1. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,613


    Did you find this post helpful? Yes | No

    Default

    Hi,
    If you use GOTO you can't use RETURN.
    RETURN is only used when you jump to a routine using GOSUB.

    You don't need ENDIF if your IF statement is one one line.

    EDIT: Except for the above, the program would jump to choise2Sub if Choise2 was evaluated true. But even if none of the IF statements were true the program would run all three subs one after the other since you haven't prevented the program to reach the subs after the IF statements. Makes sense??

    It should probably look something more like:
    Code:
    Start:
      if Choice1 goto choice1Sub    'Jump to choise1Sub if Choise1 is=1
      if Choice2 goto Choice2Sub
      if Choice3 goto Choice3Sub
    Goto start                      'Start over
    
    Choice1Sub:
    {Sous programme}
    Goto start			'Start over
    
    Choice2Sub:
    {Sous programme}
    Goto Start			'Start over
    
    Choice3Sub:
    {Sous programme}
    Goto Start			'Start over

    /Henrik Olsson.
    Last edited by HenrikOlsson; - 18th February 2007 at 10:20. Reason: Forgot one thing.

Similar Threads

  1. Data Programming Error at 0000
    By cpatnoi in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd May 2009, 03:37
  2. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  3. PIC programming algorithm - where is it to find?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2007, 18:31
  4. Some questions for programming
    By fnovau in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2006, 16:04
  5. MELab Programming
    By tarr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2006, 13:36

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts