Example of the Typescript language
// addNumbers.ts
// Function to add two numbers
function addNumbers(a: number, b: number): number {
return a + b;
}
// Variables representing two numbers
let num1: number = 5;
let num2: number = 8;
// Call the function and store the result
let sum: number = addNumbers(num1, num2);
// Output the result to the console
console.log(`The sum of ${num1} and ${num2} is: ${sum}`);
Output:
The sum of 5 and 8 is: 13
Contact Us