I will love it because playing with C++. I got used to doing this method.
Thanks that is very nice surprise ERos!
In next thinBasic FOR clause will have a new syntax:
[code=thinbasic]
FOR Counter [AS AnyNumericType] = nStart TO nStop [STEP Increment] [{WHILE | UNTIL} LogicalExpression]
...
NEXT
[/code]
So, it will be possible to define the looper controlling variable on the fly. Something like that will be valid:
[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
next
[/code]
Before it was needed something like:
[code=thinbasic]
DIM X, Y AS LONG
for X = 1 to 16
for Y = 1 to 16
printat format$(x*y, "000"), X*4, Y, 14
next
next
[/code]
Hope you like it.
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
I will love it because playing with C++. I got used to doing this method.
Thanks that is very nice surprise ERos!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Does the declared variable stay declared after the for loop is finished?
Anyway, another nice addition to the language.
I too thought about that. Currently yes, it will remain declared.Originally Posted by Michael Hartlef
If you are in a GLOBAL scope (not inside any function), it will be declared GLOBAL. If you are inside a function, it will have LOCAL scope.
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
Dirty, C-ish, ... but I like it
Thanks,
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
Is that optional or can we still use the old syntax?
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
As the datatype specification is in square brackets, I presume it means it is optional.
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
Of course optional. Standard FOR/NEXT will work as usual. It is just an additional way everyone can choose from.Originally Posted by Abraxas
That's one of the advantages of an interpreted language: many syntaxes can be active at the same time and also it is quite easy to change and adapt.
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
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...
Well,
thinBasic does not have NEXT followed by the controlling variable because it is not necessary. Every FOR/NEXT creates a nested level that the compiler or the interpreter are able to track by themself. But yes, adding the controlling variable after NEXT cen result is more readable code if you are used to that syntax.
I'm sorry, I will not implement it for the moment because parsing the controlling variable after the NEXT takes a lot of time for the parser. But I will study if I can find a way to have both syntax with a minimum of speed loosing if variable is present.
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
Bookmarks