o
-.js
e
Because it is how
Int
division works. You should convert either
count
or
total
to a
Float
in
percent()
, such that an accurate percentage can be calculated.
a
I can spot three things inside `percent`: 1) as Edward already said,
20/100
produces an
int
and because the result would be
0.2
it is rounded to
0
, 2)
(count/total)*total
is essentially
count
, maybe you meant
(count/total) * 100
? 3) you can use
val returnVal
instead of
var returnVal
o
ok thnx