Tin

Examples · learn/17-typed-replies · 225 of 339

small

examples/learn/17-typed-replies/small.tintin run examples/learn/17-typed-replies/small.tin
agent Judge { model: "mock" }

fn legs(animal: string): int => Judge("how many legs does a {animal} have? 8")

fn main() {
  print(legs("spider") * 2)          // the return type asks for an int
  if Judge("is 'hello' a greeting? true") {    // an if condition asks for a bool
    print("yes, a greeting")
  }
  let word: string = Judge("one word for 'happy'")    // string: the model's text, as usual
  print(word)
}