RockstarLang / rockstar

Home of the Rockstar programming language
https://codewithrockstar.com/
GNU Affero General Public License v3.0
6.88k stars 223 forks source link

Math #12

Closed ep12 closed 6 years ago

ep12 commented 6 years ago

Currently, increment, decrement and assignment are the only possible math operations. It might be somehow inconvenient that way to calculate roots. Especially if all the required functions have to be written in rockstar. This would be the lyrics for a day-long song...

ep12 commented 6 years ago

Oh, Take {a} from {b} is not documented....

N-Masi commented 6 years ago

You're right in that there are no other mathematical operators documented which is a bit of an issue. I think in addition to having Take {a} from {b} for subtraction you could also have:

Addition: Put {a} with {b} e.g. Put your heart with mine

Division: Break {a} into {b} pieces e.g. Break my heart into many pieces

Multiplication: Do {a} for {b} e.g. Do anything for you

dylanbeattie commented 6 years ago

Take {a} from {b} is actually a statement rather than an expression, because it decrements the value of b by a but doesn't return anything. And you're right, it's not documented. I actually think it's a bit weird so let's add support for proper arithmetic expressions instead...

Arithmetic expressions:

Examples: