---
title: "Code Block Introduction 🤓"
description: "An example of how to use code blocks in AIM"
input:
- name: name
type: string
description: "The name to greet"
---
\`\`\`js {% #example %}
// The code execution node will execute the given JavaScript code
// For example we can write functions ...
function addNumbers(n1, n2) {
return n1 + n2;
}
// ... call those functions ...
const sum = addNumbers(1, 1);
// ... log outputs ...
console.log("1 + 1 =", sum);
// ... and even mention values from outside the code
const greeting = `Hello ${aimVariables.frontmatter.input.name}, you're looking good today 🔥`;
// If we return a value it'll be included in the prompt
return greeting;
`\`\`\
The code returned: {% $example.result %}