Modifying a variable?


Results 1 to 3 of 3

Threaded View

  1. #1
    ybrisson's Avatar
    ybrisson Guest

    Default Modifying a variable?

    Hello all,

    I would like to know if there's a way to minimise the number of
    "IF THEN" in this following (simplified) situation.
    (I'm new to picbasic!).


    value VAR byte

    x VAR byte

    y0 VAR byte
    y1 VAR byte
    y2 VAR byte
    y3 VAR byte
    .
    .
    .
    y15 VAR byte 'or y VAR byte[16]?


    If x = 0 Then y0 = value
    If x = 1 Then y1 = value
    If x = 2 Then y2 = value
    If x = 3 Then y3 = value

    ... and so forth

    So is there a way to modify variable "y" by using the "x" one?

    ie: yx, y.x, y[x], ???

    Thank you
    Last edited by ybrisson; - 9th October 2003 at 13:13.

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. set flags within a variable?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 24th October 2006, 11:07
  5. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16

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