Bulat Suleymanov
Bulat Suleymanov

Reputation: 13

Octave prints everything

How can I print only what I want in Octave?

original_price = input("")
tip = input("")
tax = input("")
res = original_price * (1 + tip / 100 + tax / 100)
final_price = round(res)
disp(strcat("The final price of the meal is $", num2str(final_price), "."))

I need only last line to be printed.

Upvotes: 1

Views: 225

Answers (1)

nneonneo
nneonneo

Reputation: 179422

Put a semicolon after a statement to suppress output from that statement. This doesn't suppress explicit output (from the disp function), so you can just put a semicolon after every line in your function.

Octave and MATLAB share syntax, so you can use the MATLAB symbol reference (http://www.mathworks.com/help/matlab/matlab_prog/symbol-reference.html) to learn more about the special symbols in MATLAB, including the semicolon.

Upvotes: 1

Related Questions