Exercise 1
How many times will this loop print 'Hello World'?
n = 10;
while n > 0
disp('Hello World')
n = n - 1;
end
Solution
10 times.
Exercise 2
How many times will this loop print 'Hello World'?
n = 1;
while n > 0
disp('Hello World')
n = n + 1;
end
Solution
This loop will continue to print 'Hello World' until the user stops the program. You can stop a program by holding down the 'Ctrl' key and simultaneously pressing the 'c' key.
Exercise 3
What values will the following LABVIEW MATHSCRIPT code print?
a = 1
while a < 100
a = a*2
end
Solution
a =
1
a =
2
a =
4
a =
8
a =
16
a =
32
a =
64
a =
128Exercise 4
What values will the following LABVIEW MATHSCRIPT code print?
a = 1;
n = 1;
while a < 100
a = a*n
n = n + 1;
end
Solution
a =
1
a =
2
a =
6
a =
24
a =
120









"This course provides a brief introduction to LabVIEW MathScript, the textual math componenet of LabVIEW. The modules for this course include typical syntax and programming methods commonly used […]"