octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Idea: Extension of function / return syntax.


From: Daniel Carrera
Subject: Idea: Extension of function / return syntax.
Date: Sat, 5 Jan 2013 19:36:47 +0100

Dear all,

I know that Octave is happy to extend MATLAB's syntax if that makes it
a better language. I would like to suggest an extension of the
"return" keyword so you can write functions like this:

function momentum( mass, speed )

    return  mass * speed

endfunction


In other words, instead of specifying the function outputs on the
first line, as it is normally done in MATLAB, the return function
could receive the set of values to be returned. This would make Octave
consistent with many other languages like Python and Perl.

I realize that this is a small thing, but Octave already has a history
of improving small things that MATLAB gets wrong, like adding ++, --,
endif, endfor, endfunction, # and so on. Octave fixes a lot of the
things that bother me about MATLAB, so I thought it might fix this one
too.

Opinions?

Cheers,
Daniel.
--
Lord of the rings calendar in your Linux/Unix/Mac terminal: cat
/usr/share/calendar/calendar.lotr


reply via email to

[Prev in Thread] Current Thread [Next in Thread]