✔ 最佳答案
The forward slash symbol is the divider operator | Correct
However, you cannot divide by Zero because the result of a division by zero is undefined in maths, and thus any attempt at a definition leads to a contradiction.
If you think about it, how do we define division?
The ratio r of two numbers a and b:
Mathematically this is represented by:
r = a/b
That would mean that a = r * B
But what hapens if b = 0?
A contradiction occurs! If a <>0 then b cannot equal 0 can it
So I can see you thinking, ahh but what if a = 0?
Well it is true that 0 = r * 0
Thus technically one could have 0/0 couldn't they?
As it happens this causes a contradiction in math too. If you take the example 0/0, and call the result z then if it made sense, z would have to satisfy the following equation:
z * 0=0
This is the contradiction: Any number divided by itself should equal ONE. However in this equation Z could be equal to any numerical value you can think of, thus if you alter the equation to z = 0/0 you can see there is no reason at all to assume z = 1
And these contradicions are why you cannot divide by zero on a computer or any other way.
Thus, you will need to create a conditon in your code above to ensure val(text2.text) never equals ZERO.