m
revised quiz
m (whoops 2 i am braindead) |
Iforgoragain (talk | contribs) m (revised quiz) |
||
Line 151:
|type="()"}
- a = 4
|| This defines <code>a</code> globally - not locally (or reassigns a to some other value).
- do a = 4 end
|| This defines <code>a</code> globally (not locally), and within a scope block.
Line 161:
|type="()"}
+ TRUE
|| Yup! Always defining variables in the local scope is less memory intensive and makes you less prone to mistakes
- FALSE
|| Always defining variables in the local scope is less memory intensive and makes you less prone to mistakes
{What will the following code print out? <syntaxhighlight lang="lua" line="1">
local hello = "Hello world!"
print(hello)
Line 171 ⟶ 172:
|type="()" coef="2"}
- hello
|| <code>hello</code> is a variable, so what's actually being fed into the print function is its value - "Hello world"
+ Hello world!
- "Hello world!"
|| "Hello world" is indeed what is fed into the print function, but not what is printed out
- 'hello'
|| <code>hello</code> is a variable, so what's actually being fed into the print function is its value - "Hello world"
{Consider the following code: <syntaxhighlight lang="lua" line="1">
Line 194 ⟶ 198:
+ 3, then 5
- 3, then 2
|| Scope
{ Complete the missing lines:<syntaxhighlight lang="lua" line="1">
Line 203 ⟶ 207:
c = 54
do
print(s)▼
...
...
...
▲ print(s)
end
end
Line 213 ⟶ 217:
|type="{}" coef="4"}
First missing line: { print(
Second missing line: { print(c
Third missing line: {
</quiz>
|