Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: New in next thinBasic: FOR with on-the-fly variable definition

  1. #11
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    Zlatko,

    if you are puzzled by NEXTs lacking specified variables, you can still add simple comments there:
    [code=thinbasic]
    for X as long = 1 to 16
    for Y as long = 1 to 16
    printat format$(x*y, "000"), X*4, Y, 14
    next 'Y
    next 'X
    [/code]

    It is just one character extra, and it means no hurt to parsing performance, as ThinBasic cuts the comments before execution.


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #12

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    Hi guys interesting stuff but i prefer this:
    for X as long = 1 to 16
    for Y as long = 1 to 16
    printat format$(x*y, "000"), X*4, Y, 14
    next Y
    next X
    it is easy to track...
    I must admit that I don't understand the need for having the variable following 'next'. It seems to me that for now a work around could be:

    for X as long = 1 to 16
    for Y as long = 1 to 16
    printat format$(x*y, "000"), X*4, Y, 14
    next ' Y
    next ' X

    By commenting out the variable, thinbasic can still handle the for/next loops and by having the variables there as comments it still remains clear.
    Just my thoughts on the subject.

    Thanks
    Sandy

  3. #13
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    OK, done.

    Next thinBasic version will manage both syntax without speed reduction.
    thinBasic will allow the Counter variable after NEXT keyword but it will be ignored and parsing will jump over the next token.

    There will be no execution speed reduction because there will be a check of the presence of Counter variable after NEXT keyword during Script-Pre-Parsing phase. During this phase, if parser will find some NEXT followed by looper variable, they will be "marked" so real execution will just ignore the next tokens and jump to the exd of line.

    Ciao
    Eros
    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

  4. #14

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    Wow i just give suggestion i dont mean nothing wrong.Ok
    regards

  5. #15
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    In fact your suggestion has been taken into consideration

    Thanks
    Eros
    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

  6. #16

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    Wow i just give suggestion i dont mean nothing wrong.Ok
    regards
    I don't think you did anything wrong! I hope you didn't get any ideas from what I said that could have made you think you did anything wrong. I believe that any suggestions can and should be made. Please feel free to make any suggestions you have.

    Thanks
    Sandy

  7. #17

    Re: New in next thinBasic: FOR with on-the-fly variable definition

    OK sandy

Page 2 of 2 FirstFirst 12

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
  •