Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Anton Sigurdsson
1,357 Pointssyntax error (5:4)
So this is how I set it up, but I cant get past this syntax error, what am I doing wrong???
function max(high, low) {
return high + low;
if (high > low); {
return high;
} else {
return low;
}
}
}
max (4, 5);
1 Answer

teofanescucosmin
14,051 PointsI modify you code to work. Check it and try to understand it.
function max(high, low) {
if (high > low) {
return high;
} else {
return low;
}
return high + low; // this code will never RUN .
}
max (4, 5);
When a function will get a return will stop and not continue. That meen you never enter in "if"condition with your code thats why i put it down but is better to remove it ! Another error i find is after if(high > low) you put an ";" and that trow a sintax error .