view examples/code/@polynomial/get.m @ 33658:b1d6e40ac737 stable tip

NEWS.9.md: Fix typo and minor formatting changes. * etc/NEWS.9.md: Fix typo. Adjust whitespace. Use markdown syntax for code snippets.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 05 Jun 2024 11:27:35 +0200
parents 28de41192f3c
children
line wrap: on
line source

function val = get (p, prop)

  if (nargin < 1)
    print_usage ();
  endif

  if (nargin == 1)
    val.poly = p.poly;
  else
    if (! ischar (prop))
      error ("@polynomial/get: PROPERTY must be a string");
    endif

    switch (prop)
      case "poly"
        val = p.poly;
      otherwise
        error ('@polynomial/get: invalid PROPERTY "%s"', prop);
    endswitch
  endif

endfunction