Well you can do it with a bunch of conditions. For two vars
If A>B
If B<A
If A=B
For three you just do the same for all cases
a>b and a>c
B>a and b>c
C>a and c>b
A=b and a>c
A=c and a>b
B=c and b>a
A=b and b=c
For four it would be similar.
Another way would be an array.
3 a
22 b
4 c
Then you could sort the array to get the greatest, but you’d need some logic to when there are multiple with the same value.
A third idea that I like best is to use sprites instead. Make a sprite called item, give it two variables: name and value. Then just create an instance for each fruit and set the vars.
Finally to get the highest and get a random one when there is a tie you’d do:
For each item ordered by item.value+random(0.5) descending
— set best to item.name
— stop loop