-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtestTypeScript.ts
More file actions
35 lines (25 loc) · 834 Bytes
/
testTypeScript.ts
File metadata and controls
35 lines (25 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Begin ---------------------------------------------------------------
/**
* @param in_name {string}
* @param in_age {number}
* @returns {string}
*/
function addNumbers(a: number, b: number) : number {
return a + b;
}
let subNumbers = (a: number, b: number) : number => {
return a - b;
}
const getHelloWorld = (name: string, age: number) : string => {
return `Hello World from ${name} with the age ${age.toString()}`;
}
function main(name: string, age: number) {
const sum: number = addNumbers(10, 15);
const diff: number = subNumbers(15, 10);
const hello: string = getHelloWorld(name, age);
return "Sum of the two numbers is: " + sum + "\n" +
"Diff of the two numbers is: " + diff + "\n" +
hello;
}
main(in_name, in_age);
// End -----------------------------------------------------------------