When you start defining a function in scilab, scilab changes how it spaces commands. Compare -->x = 2; -->x^2; -->// last answer was 4 -->ans ans = 4. --> With the function definition f(x) = x^2 -->function y = f(x) -->y = x^2; -->endfunction -->f(2); -->// last answer was 4 -->ans ans = 4. --> Notice the single spacing while the function is being defined. A common beginners error is to write `end function' instead of the one word `endfunction'. Scilab still thinks you are definding a function, it fact it thinks you are now starting a new function inside the first function. You now have to type endfunction twice to end the definition of the first function. -->function y = f(x) -->y = x^2; -->end function -->f(2); // note the spacing, I haven't ended the function -->you stupid scilab why are you not giving 4 -->damn it give me back my old line -->endfunction -->// we ended the second function on line 3 -->endfunction end function !--error 34 incorrect control intruction syntax at line 3 of function f called by : endfunction -->// now we are back and tells us about our error on line 3