Files
orchid/examples/lite/main.orc
2023-03-21 19:36:40 +00:00

23 lines
569 B
Plaintext

import prelude::*
import std::conv::(parse_float, to_string)
import std::cpsio::(readline, print)
import std::str::(concatenate)
export main := do{
cps data = readline;
let a = parse_float data;
cps op = readline;
cps print ("\"" ++ op ++ "\"\n");
cps data = readline;
let b = parse_float data;
let result = (
if op == "+" then a + b
else if op == "-" then a - b
else if op == "*" then a * b
else if op == "/" then a / b
else "Unsupported operation" -- dynamically typed shenanigans
);
cps print (to_string result ++ "\n");
0
}