-
Notifications
You must be signed in to change notification settings - Fork 23
Lesson07 #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson07 #333
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert changes to this file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,15 @@ | |
* @return True if the age corresponds to a voting age and false otherwise. | ||
*/ | ||
export function canVote(age: number): boolean { | ||
return false; | ||
if (age >= 18) { | ||
return true; | ||
} | ||
|
||
else { | ||
return false; | ||
} | ||
} | ||
console.log(canVote(18)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line should not be here, please remove. |
||
|
||
/** | ||
* Adds all of the provided values and returns the sum. | ||
|
@@ -15,15 +22,35 @@ export function canVote(age: number): boolean { | |
* @return The sum of all the values. | ||
*/ | ||
export function addNumbers(values: number[]): number { | ||
|
||
|
||
for (let i = 0; i < values.length ; i++) { | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't have all of these extra line breaks, fix formatting. |
||
return values[i]; | ||
} | ||
|
||
|
||
return 0; | ||
} | ||
|
||
|
||
/** | ||
* Computes the factorial of the given value of `n`. | ||
* | ||
* @param n The value for which to compute the factorial. | ||
* @return The factorial of n. | ||
*/ | ||
export function computeFactorial(n: number): number { | ||
|
||
if (n <0 ){ | ||
|
||
return 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix formatting and indentation. |
||
} | ||
|
||
let factorial = 1 | ||
|
||
|
||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR must only include changes for lesson_07. Please revert this file.