This function is producing the error message "The return effect can only be used in functions, custom expressions..." and I don't know what the issue is.
function toInt(rawNumber: text):
set {_value} to {_rawNumber}
replace "," in {_value} with ""
if {_rawNumber} contains "k" or "m" or "b":
replace "k" in {_value} with "000"
replace "m" in {_value} with "000000"
replace "b" in {_value} with "000000000"
if {_rawNumber} contains ".":
set {_numbers::*} to {_rawNumber} split at "."
replace "k" or "m" or "b" or "." in {_numbers::2} with ""
set {_numLength} to length of "%{_numbers::2}%"
replace "." in {_value} with ""
set {_numValue} to {_value} parsed as integer
set {_numValue} to {_numValue} / 10 ^ {_numLength}
set {_value} to "%{_numValue}%"
set {_numValue} to {_value} parsed as integer
return {_numValue}