|
Post by johnno56 on May 3, 2020 4:27:23 GMT -6
They all look pretty good and, for me, easy to follow. I would imagine that, if you are looking for potential efficiency, perhaps dropping the curly brackets. (a little bit less for the interpreter?)
|
|
|
Post by Tomaaz on May 3, 2020 6:09:44 GMT -6
Just have one flexible for loop.
for iter, start, end, step { ... }
for element in [string/array] { ... }
for (condition) { ... }
for { ... break }
|
|
|
Post by aurel on May 3, 2020 9:36:50 GMT -6
-
|
|
|
Post by Tomaaz on May 3, 2020 11:30:43 GMT -6
Go and V have only for loop. Other suggestions. Don't use "$", "#", "%". Instead make variables to be mandatory declared prior use. Make arrays dynamic with an option to assign values in one line. One of the worst things in (traditional) BASIC is the fact that you have to declare type and a size of variable and then set values one by one, while in other languages you can simply do:
my_array = [34, 67, 89, 100, 3456]
Also, elements can by of different types and you can easily manipulate arrays:
first_array = [36, 78, "tomaaz", 987, 145, "aurel"] second_array = [56, 87, "johno", "tomaaz"]
Add element: second_array.append(145)
Merge arrays: third_array = first_array + second_array
Create another array that contains all elements from the first array that are not in the second array: another_array = list(set(first_array) - (set(second_array)))
Create another array that contains only those elements of another_array that are strings and numbers bigger than 100 final_array = filter(lambda x: isinstance(x, str) or x > 100, another_array)
This is all MUCH EASIER AND FASTER than using loops, DATA, READ etc. and it's the main reason why BASIC has lost.
|
|
|
Post by aurel on May 3, 2020 13:18:33 GMT -6
|
|
|
Post by aurel on May 5, 2020 6:17:40 GMT -6
-
|
|
|
Post by aurel on May 7, 2020 7:39:37 GMT -6
-
|
|
|
Post by aurel on May 11, 2020 5:36:17 GMT -6
-
|
|
|
Post by aurel on May 11, 2020 13:32:07 GMT -6
-
|
|
|
Post by aurel on May 12, 2020 3:24:37 GMT -6
-
|
|
|
Post by aurel on Jun 15, 2020 4:46:16 GMT -6
-
|
|
|
Post by aurel on Jun 21, 2020 7:06:12 GMT -6
-
|
|
|
Post by aurel on Jun 21, 2020 12:06:57 GMT -6
-
|
|
|
Post by aurel on Jul 19, 2020 12:20:17 GMT -6
-
|
|
|
Post by johnno56 on Jul 19, 2020 18:23:42 GMT -6
Hi Aurel,
Had a look at your source code. I'm not even going to pretend to understand a lot of things that I saw... What I did notice were the keywords... You have included all the basics (no pun intended) and kept it simple.. I do like simple... Great job!!
Even "I" could follow your 'fern' example... One curious point... The 'print' statement places the string at the graphics cursor... That would imply that, if you wanted scrolling text, a routine would have to be used... Not sure if I'm explaining properly... For example: Some Basics would automatically scroll the screen up if and when the printed text is placed at the bottom of the screen... I'm not complaining. Just trying to confirm that 'print' is used similar to Rcbasic's DrawText...
Well... I for one am impressed by what you have done! Keep it up!
|
|