Make a number negative (operators)
-
Since there is absolute value as an operator, there should be an option in the same block that lets you make a positive number negative
-
@011830-0a42ef84 True, that would be handy. What would be cool is if that was part of a custom extension, because then it could be used in other mods such as Turbowarp.
(We have mentioned the Idea to add support for custom extensions).In the meantime, that block can be created using this short code below. X represents the number you are working with.
((abs(X)*(-1))
You know what block would also be cool to have? The to the power of block. It might look like this:
(X^(Y))
-
@mod-squadacademy-1bc96c56 They already have that block:
-
@011830-0a42ef84 the best way is 0-abs(number) or just 0-number
-
@mod-squadacademy-1bc96c56 have you checked out hte editor? They have regex and url param stuff aswell
-
@tyller_ Could you please clarify?
-
@mod-squadacademy-1bc96c56 The editor has blocks for regex support and reading url parameters among other things, there is so much stuff added to the categories it’s very easy to miss some very advanced/useful features.
Edit: I meant by checked out gone through it and really looked at all the blocks, I’ve assumed you skimmed through it a bit.
-
@011830-0a42ef84 use absolute value, then ( join (-) (number) ) . That will just make the number negative because abs value makes it positive, and you can just turn a positive into a negative literally with the negative sign. You could also do a longer solution, where you check if the number starts with “-”, and if it does, then dont do anything, and if it doesnt, then the number is positive, and you can just join that number and “-”.
-
@jeffreyrb03-gmail
Surely this:((abs(X))*(-1))
Would take up less space than this:
(join (-) ((abs(X)))