Reading — step 1 of 5
Learn
~1 min readNumerical Basics
GNU Octave was started in 1988 to teach undergrad numerical methods. Today it's a full open-source MATLAB alternative — with the same syntax, mostly compatible toolboxes, and a thriving community.
disp("Hello, Octave!")
disp(x)writes x followed by a newlineprintf("format", args)for C-style formatted output- Comments use
%or#(both work) - Statements end with newline; suppress output (when assigning) with trailing
; - Strings can use single or double quotes — both behave the same way for plain ASCII
Reading stdin: input("") reads a value from stdin. With second arg "s" it reads as a string:
n = input("") % reads as a number
line = input("", "s") % reads as a string
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…