We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
We solved that problem with negative numbers with initialAge ( if (initalAge < 0){...} ).
So, my opinion is we dont need second "else if(...){..}" just else{...}.
And also, we dont need else in initialAge, so like this:
if(initalAge < 0){...}
age = initialAge;
But this is only my opinion, and
I'm new in all this.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Class vs. Instance
You are viewing a single comment's thread. Return to all comments →
We solved that problem with negative numbers with initialAge ( if (initalAge < 0){...} ). So, my opinion is we dont need second "else if(...){..}" just else{...}.
And also, we dont need else in initialAge, so like this: if(initalAge < 0){...}
age = initialAge;
But this is only my opinion, and I'm new in all this.