Code examples
An example of a codeblock for Python:
add_numbers.py |
---|
| # Function to add two numbers
def add_two_numbers(num1, num2):
return num1 + num2
# Example usage
result = add_two_numbers(5, 3)
print('The sum is:', result)
|
Example codeblock for JavaScript with lines highlighted:
concatenate_strings.js |
---|
| // Function to concatenate two strings
function concatenateStrings(str1, str2) {
return str1 + str2;
}
// Example usage
const result = concatenateStrings("Hello, ", "World!");
console.log("The concatenated string is:", result);
|