Revision 013d5f1b-4548-450d-9fc4-c77d702ccd02 - Code Golf Stack Exchange

<sub>Related, but not identical [tips for MATLAB][1].</sub>

A little known and little used feature of Octave is that most builtin functions can be called without parentheses, in which case they will treat whatever follows it as a string (as long as it doesn't contain spaces). If it contains spaces you need quotation marks. This can frequently be used to save a byte or two when using `disp`. All the following work, and gives the same result:

 disp('Hello')
 disp Hello
 disp"Hello"

If you have spaces, then you _must_ have the quotation marks:

 disp('Hello, World!')
 disp"Hello, World!"

Other, less useful examples include:

 nnz PPCG
 ans = 4
 
 size PPCG
 ans = 1 4
 
 str2num 12
 ans = 12


 [1]: https://codegolf.stackexchange.com/a/111979/31516

AltStyle によって変換されたページ (->オリジナル) /