Results 1 to 9 of 9

Thread: Circular Next/Previous

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Circular Next/Previous

    I've developed 2 new functions to simplify circular numbers that is numbers that must have a range of values and be incremented/decremented by something but when they reach their bounds (upper or lower) they restart from the other side.

    For example imagine you have a set of options from 1 to 4 and want always add 1 but when it reach 4, adding 1 will restart from 1. The same when subtracting 1 if it will reach 1 it will restart from 4.

    I've developed the following 2 functions:
    MyNumber = NNEXT(MyNumber, nMin, nMax, nIncr)
    MyNumber = NPREV(MyNumber, nMin, nMax, nDecr)
    
    but I do not like the names: NNEXT and NPREV.

    Do you have something to suggest? I was thinking about CIRCULAR_NEXT and CIRCULAR_PREV

    Ciao
    Eros
    Last edited by ErosOlmi; 10-06-2013 at 22:30.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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