Difference between revisions of "W1201 Scope"

From Coder Merlin
(Created page with "= Scope = == Research == * [https://en.wikipedia.org/wiki/Scope_(computer_science) Scope (Wikipedia)] * Media:ComputerScienceOne.pdf|Computer Science I Textbook (by Bourke...")
 
Line 19: Line 19:


For this project you'll repeatedly edit the same file.  It's probably easiest to test this file ''within emacs'' by typing:
For this project you'll repeatedly edit the same file.  It's probably easiest to test this file ''within emacs'' by typing:
'''M-&''' (async-shell-command)  and observing the results.  For each question, be sure to '''understand''' the behavior before proceeding to the next question.  It will be helpful to '''record''' your answers for later review.
'''M-&''' (async-shell-command)  and observing the results.  For each question, be sure to '''understand''' the behavior before proceeding to the next question.  It will be helpful to '''record''' your answers and reasoning for later review.
 
=== Question 1 ===
<quiz shuffleanswers=true display=simple>
{
<syntaxhighlight lang="swift>
let x = 10
print(x)
</syntaxhighlight>
What is output? (Ignore whitespace)
|type="()"}
+ 10
- 21
- 23
- Compile or runtime error
</quiz>

Revision as of 23:51, 24 February 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Scope[edit]

Research[edit]

Experiment[edit]

Create a directory within your "project" directory.

cd ~/projects
mkdir project-1201
cd project-1201

Edit a new file named "main.swift"

emacs main.swift

For this project you'll repeatedly edit the same file. It's probably easiest to test this file within emacs by typing: M-& (async-shell-command) and observing the results. For each question, be sure to understand the behavior before proceeding to the next question. It will be helpful to record your answers and reasoning for later review.

Question 1[edit]

let x = 10
print(x)

What is output? (Ignore whitespace)

21
10
23
Compile or runtime error