Idea: Factorial block

A feature I’d like to see in Hopscotch is: A factorial block. If you don’t know what it is, it’s all the numbers multiplied from 1 to x.

I’d use it for this type of project: A calculator and a couple other things

Here are some examples of Hopscotch code that could be improved if we had this: Instead of having to do 4 • 3 • 2 • 1 we could do (4!) The exclamation mark is the factorial symbol.

Here is an example design I’ve made:

I’ve seen something similar in another programming languages, it looks like this: I haven’t seen anything similar

If there is something like this please tell me!

16 Likes

This would be cool!

So a factorial of 4 would be 4 x 3 x 2 x 1?

7 Likes

Yes

6 Likes

that would be awesome, nice!

5 Likes

Cool! Should also include factorial +, - and /

5 Likes

Uh, that’s not how math works?

5 Likes

I was wondering that. I thought factorials were only multiplying.

4 Likes

Correct. Also the symbol is ! –– you’d have 5! = 5*4*3*2*1

4 Likes

Yes, but what I mean is 4+3+2+1, 4-3-2-1 and 4/3/2/1

4 Likes

4/3/2/1 is not possible unless you want a number super small.

4 divided by 3 = .75 divided by 2 = .375 divided by 1 = .375

4 - 3 - 2 - 1 = - 2

Imo the only sensible one would be 4 + 3 + 2 + 1 = 10

6 Likes

Why would we need this? I don’t think THT should go around adding random blocks that will barely be used.

6 Likes

Well, more math is always cool! But I understand what you mean. I am pretty sure that having this feature would be useful.

9 Likes

Yes, but only the normal factorial (!)

5 Likes

Yeah
I agree w ae

5 Likes

I have created this project that does this, so this might not be of any practical use.

3 Likes

Yup, but the idea was to have it integrated
Long time no see, last time was my GT
D:

3 Likes


May I ask you to simplify the algorithm a little?

2 Likes

Thank you and welcome to the forum!

Welcome to the forum!

But where could we use it?