1.4.9 - Entering multiple statements per line
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Write a line that assigns the value 10 to x, and then assigns the value of 5 + x to y.
💡 Hint: Use a semicolon to separate the two assignments.
Enter a command that sets a=2, then displays the value of 3*a.
💡 Hint: Don't forget to include the semicolon after the assignment!
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the result of a=7; b=cos(a), c=cosh(a)?
💡 Hint: Remember what the comma does in terms of output.
True or False: Using a semicolon at the end of a line in MATLAB will result in output being displayed.
💡 Hint: Think about the purpose of the semicolon.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Write a line of code that combines the commands to define two variables, x=8 and then calculate the square of x and assign to squared, showing the value of squared in output.
💡 Hint: Use a comma to display the calculated value of `squared`.
Combine the commands to set two angles in degrees, theta1=30 and theta2=45, and then calculate their sine values suppressing their outputs in one line.
💡 Hint: What punctuation will you use to avoid displaying intermediates?
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.