4 ms·
hey, I was looking for even? in the language wiki https://github.com/arturo-lang/arturo/wiki https://github.com/arturo-lang/arturo/wiki , as in: if? even? x ->
by bryanrasmussen 6y ago
hey, I was looking for even? in the language wiki https://github.com/arturo-lang/arturo/wiki https://github.com/arturo-lang/arturo/wiki , as in:
if? even? x -> print [x "is even"]
but I couldn't find it in Arithmetic, Comparison, Core, Logic, or Numbers - I figured those were the most obvious places to look.
I was wondering specifically if this example
loop 1..10 'x [
if? even? x -> print [x "is even"]
else -> print [x "is odd"]
]
could be rewritten
loop 1..10 'x [
even? x -> print [x "is even"]
odd? x -> print [x "is odd"]
]
and what other number checking things one could do - like decimal?, positive? negative?
- stchacademy 6y agoWell, you have a point here: even? (and odd?) is somehow missing from the (auto-)generate docs at the wiki. I'll fix it asap. Thanks for letting me know. Regarding the syntax: every "function" in Arturo takes a specific number of arguments. in that case: loop, if?, even? else are ALL functions (there are no special constructs in Arturo, nor reserved keywords). Regarding your second example/question: you could have written it like that, but it wouldn't do as you expect. What can be done though is using the 'case function. For any other questions, doubts, ideas or even code contribution, you're welcome to post anything at Github or via our Gitter community: https://gitter.im/arturo-lang/community https://gitter.im/arturo-lang/community or Discord: https://discord.gg/YdVK2CB https://discord.gg/YdVK2CB
- stchacademy 6y agoFYI, I've just published the first complete reference (language reference + full library reference, with tons of examples): https://github.com/arturo-lang/arturo/wiki https://github.com/arturo-lang/arturo/wiki Let me know what you think! :)