#`for` loop, similar to `repeat`
1 messages ยท Page 1 of 1 (latest)
it is possible to make a "for" loop with "repeat"
just gimmie a sec
you know the $i?
you can use that
heres a hand made for loop (no counting down but i might figure that out)
var $max = 15
var $min = 10
var $has0 = 0
repeat $max ($i)
if $i == 0 and $has0 == 0
$i = $min
$has0 = 1
print($i)
*this makes a thing where it goes from 10 -> 15
it also supports min being under 0 (due to the $has0)
but yea
a for loop would be nice
yeah im aware haha, it's just this would be more convenient
yep
Oh @keen dome isn't going to like this suggestion at all ๐. Adding the abomination of all loops to his code? ๐
var $i = 0
while ($i > 10)
; // do stuff
$i++```
The new for loop
I think you have a mistake there ๐
count down would be as simple as:
repeat 5 ($i)
print 5-$i
5
4
3
2
1
the usual for ( ; ; ) syntax can always be replaced by something simpler
Counting down/up is pretty much the same.
var $i = 10
while ($i > 0)
; // do stuff
$i--```
Oh, so you caught the dead loop issue ? ๐
I knew that was coming.
oh yeah damn thats tragic
how come this got rejected?
Because of Xenoncode's mindset, which aims to remain a simple language.
More possibilities don't necessarily make the language more difficult, but it becomes indirectly harder due to the growing documentation as the language expands, which gives the impression that it's complex.
All these kinds of small additions make life easier for advanced developers but can hinder learning for beginners, even if in the end they might appreciate having this addition.
In this case, the solution to do the same thing is so simple that Batch doesn't think it's worth supporting an extra syntax that could overwhelm beginners.
alright thats fair enough
on second thought, i feel that your philosophy is a tad flawed. languages like python are full of features that sure, aren't needed, but really come in handy sometimes. even with all the features, the foundation of it is easy to learn thanks to plenty of documentation and tutorials
essentially, adding features to xenoncode that don't complicate things (like for loops ๐) or are simply optional to use doesn't make the language harder to learn for beginners imo. rather the quality of documentation and tutorials is what dictates whether xenoncode is hard or easy to learn
all love though, don't mean to sound like an ass or anything, just want to see more features in xenoncode because the language is a tad limiting in some aspects atm
Your suggestion is a great one, the problem is there are hundreds of possible good additions like this, each requiring a couple lines in the documentation, accumulating these additions will end up making XenonCode more complicated to learn. Even if the features are optional, they still add things to learn to the documentation for new users.
yeah itll undoubtedly make xenoncode a tad more complicated but i dont know man, limiting the language due to the potential of making the language harder to learn doesn't seem too good
imo i think one of your main focuses for xenoncode should be ensuring the foundation of the language (things that are essentially required to learn like functions, variables, callbacks like init, etc) are easy to learn instead of everything as a whole
the language becomes hard or easy to learn depending on your documentation too, so its not really the syntax or buttload of features that makes xenoncode easy/hard to learn but mainly the documentation as said before
@wheat edge You win this one, I will see what I can do
ayee awesome appreciate it man
Wait, we're getting for loops?
perchance
added in the latest update