Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for variables #89

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Adding support for variables #89

wants to merge 12 commits into from

Conversation

basta
Copy link

@basta basta commented Dec 4, 2020

Variables work by modifying the expression input. You have a dictionary known_variables. In it, you have key value pair of radius: 8.14 (for example).
Then if the expression is 2 + radius => 2 + 8.14 internally.
The result is 10.14. Declaring variables is also easy
"value = 50*2" Result of this is value of variable => 100
"value + 2" Result of this is 102

Sadly I had to modify more things.
I had to remove xo and npm lint from package.json because I was unable to build otherwise because of errors in last commit. I will happily change this if any of the maintainers tell me what to do about it.

I don't think it would be a good practice to change a lot of the code in a pull request because some errors are for example a wrong capitalization of a comment.

Example: radius+2 becomes (value of radius)+2 => 8.14+2
Currently variables only defined in code in main.js/known_variables
… because there were too much errors (Warnings, that prevent releasing). It's temporary but I don't know what else to do
…e of unclean working tree. I really don't understand this js stuff
@sarthology
Copy link
Collaborator

Hey @BastionInCzech
Thanks for the submission. Will review this first thing in the morning.

@basta
Copy link
Author

basta commented Dec 7, 2020

Did some more last-minute testing, but I think it's okay at this stage. Coudln't find any more bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants