Libraryless. Click here for Pure Java version (1635L/11K/37K).
!752 p{ makeBot("Unit converter bot"); } answer{ if(matchStart("* * to *", s, m)){ double num = Double.parseDouble(m.unq(0)); S from = m.unq(1); S to = m.unq(2); if(from == "c" && to == "f"){ Double result = (num * 1.8) + 32; ret "" + result; } if(from == "f" && to == "c"){ Double result = (num - 32) / 1.8; ret "" + result; } if(from == "m"){ if(to == "mm"){ Double result = num * 1000; ret "" + result; } if(to == "cm"){ Double result = num * 100; ret "" + result; } if(to == "dm"){ Double result = num * 10; ret "" + result; } if(to == "dam"){ Double result = num / 10; ret "" + result; } if(to == "hm"){ Double result = num / 100; ret "" + result; } if(to == "km"){ Double result = num / 1000; ret "" + result; } } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment