How to compare two numbers?

I am making a scoreboard app. I am trying to make the app recognize the winner in a football game so when its full time a label will say congratulations “team name”. What do i do to make the app recognize which team has a higher value for the label to say that

And also, im sorry if the title is hard to understand or has no resembelance to the problem. i didnt know what to write?

1 Like

Welcome to Thunkable!

You can use the Logic blocks to do that:

If you get stuck, post a screenshot of the blocks you’ve tried and explain what happens when you Preview the project. Someone can then help you further.

1 Like

Labels in Thunkable treat the value in them as text even if it’s in a form of a digit. You need to us math block to add the value in the label to ZERO which will convert it to a number that you can check for highest score.


This is what i’ve done so far, so when the the timer’s text equals to full time, minus the scores with each other. If it equals 0 then recognize it as a draw. And when if the scores minus each other equals to a random integer between 1 and a million it will recognize it as a draw, so far the app works only when i its a draw but when its not a draw it dosen’t recognize it as a win or a loss

1 Like

When comparing numbers, you should use the Math blocks not the text block. The red block with 0 makes it text not number.

The two conditions that has random blocks could be true 1 in a million so will not resolve to the required condition.

I’ve already changed the text block to a maths block. What exactly
do i need to do in order to fix the required condition

This is so different than what you first described about a scoreboard that I’m really confused. What is the context for all of this? Is this an app that will be used with actual live sports or is it more of a rock/paper/scissors type game… or something else?

And why the comparison to a random number? What purpose does that serve? Isn’t it a draw only if the two numbers are the same? And the easiest way to compare those is just to see if they equal each other. Because if 3=3, it’s the same as 3-3=0.

1 Like

It will be a scoreboard used for live sport. And I thought if i used the “label number” minus “label number” equal random integer it will set the label visibility to true if the “label number” minus “label number” is a number between 1 and a million

It sounds like what you’re thinking is: “If the first person enters 5 and the second person enters 12 then I want to see if those numbers or their sum/difference are between 1 and a million.” But that’s not what your blocks are doing. They are picking a random number, let’s say 54878 and then checking to see if the difference of your numbers is exactly equal to 54878.

You need to use the < and > blocks instead.

What type of sport? You said “fotbal.” What are the maximum possible scores? If you mean football, then the maximum score is probably 10 or so unless you mean American Football and then it’s probably 100. Have you considered buttons to increase & decrease the score instead of having players type them in? It seems strange to me to check if the scores are less than a million. Why not just force the players to enter values that are valid?

I’ll try the block and see if it works. I also meant football (If you’re American you will call it soccer) so there is no maximum score, and i do have buttons for the players to add the score

Right but what I’m saying is that there’s not really a need to check if the score is less than a million. A football match is only going to go up to maybe 10 or 20 max, right? So just check if the number is less than 20 or less than 100, something like that. Anything above that would be incorrect. Personally, I’d just make buttons that change the score but you may have a reason to use text input. Text input is problematic because someone might type in “three” and then your code won’t work at all even though it’s a “valid” score.

Here’s an example of what I mean:

https://x.thunkable.com/copy/47f8e9b63b1a9c694ee0aede101e5351

1 Like

Thanks mate, it works now!

1 Like