diff options
-rwxr-xr-x | blaunits.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/blaunits.rb b/blaunits.rb index 5aef90c..257927f 100755 --- a/blaunits.rb +++ b/blaunits.rb @@ -121,12 +121,17 @@ begin units_error = out out = get_crypto_price(from, to) if out.split(" ")[0] == "Error:" - if units_error.split(" ")[1] == "Incompatible" - puts units_error + reverse_out = get_crypto_price(to, from) + if reverse_out.split(" ")[0] == "Error:" + if units_error.split(" ")[1] == "Incompatible" + puts units_error + else + puts out + end + exit else - puts out + out = 1/Float(reverse_out) end - exit end end |