Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do we use operators?
- Falvax
-
7 posts
How do we use operators?
Hey I completely don't know how to use operators like people divide then subtract them with variables if you could do a tutorial on that it would mean the best - thanks or if you could find one explaining it I would very much apricate it. or anything I don't know how they make math formulas
- Falvax
-
7 posts
How do we use operators?
I know how to add subtract times divide like how do we put them together to make formulas and physics and everything
- deck26
-
1000+ posts
How do we use operators?
What are you actually trying to do? The operators just function as you'd expect.
The only thing to watch is when you combine them - in the same way brackets tell you the order to do things
(a+b) * c - add and then multiply
a + (b*c) - add a to the product of b and c
the blocks can be combined in different ways
The only thing to watch is when you combine them - in the same way brackets tell you the order to do things
(a+b) * c - add and then multiply
a + (b*c) - add a to the product of b and c
the blocks can be combined in different ways
- Falvax
-
7 posts
How do we use operators?
yes but what do they do when they are combined and if I am making a game and need to combine them do do I know which ones to use?
- sideyard
-
100+ posts
How do we use operators?
Operators handle Booleans and do arithmetic and trigonometric mathematical functions. yes but what do they do when they are combined and if I am making a game and need to combine them do do I know which ones to use?
For example: Addition, Subtraction, Multiplication, Division, and/or blocks and more
- Falvax
-
7 posts
How do we use operators?
How do I know when to combine them also how do we combine them which way a + b divided by 5 like???
- deck26
-
1000+ posts
How do we use operators?
You're probably best giving some examples of what you're trying to do.
Variables can be used for all sorts of things and combined in hundreds of ways. How to combine them depends on the exact situation.
For example, if you're travelling at a fixed speed then the distance you've gone in time T is just a multiplier of the speed. If the speed is 30 miles per hour and the time is half an hour you've gone 15 miles.
But if you're accelerating the formula has to change.
If you spend money it's a simple check - do you have enough money. if you spend it you subtract the cost of the item from the money you had. But if you're saving the money in a bank and getting so much interest a year then you get into the calculation of compound interest.
At the end of the day there's nothing magical about how you combine variables, you just have to understand what calculations are appropriate to what you're doing and it is impossible to give general advice, it needs to be specific to your application.
Variables can be used for all sorts of things and combined in hundreds of ways. How to combine them depends on the exact situation.
For example, if you're travelling at a fixed speed then the distance you've gone in time T is just a multiplier of the speed. If the speed is 30 miles per hour and the time is half an hour you've gone 15 miles.
But if you're accelerating the formula has to change.
If you spend money it's a simple check - do you have enough money. if you spend it you subtract the cost of the item from the money you had. But if you're saving the money in a bank and getting so much interest a year then you get into the calculation of compound interest.
At the end of the day there's nothing magical about how you combine variables, you just have to understand what calculations are appropriate to what you're doing and it is impossible to give general advice, it needs to be specific to your application.
Last edited by deck26 (May 19, 2024 15:27:42)
- deck26
-
1000+ posts
How do we use operators?
Hard to make sense of what you actually want. How do I know when to combine them also how do we combine them which way a + b divided by 5 like???
If you want to add a and b you do that. If you then want to divide by 5 you do that after adding. So that means the block
is dragged into the left hand gap in the block
- Discussion Forums
- » Help with Scripts
-
» How do we use operators?