diff --git a/www/public/site.css b/www/public/site.css index 5fb69b073d..008f7088d3 100644 --- a/www/public/site.css +++ b/www/public/site.css @@ -24,13 +24,19 @@ code.snippet, samp { white-space: pre; padding: 10px 16px; background-color: #eee; + margin-bottom: 16px; } -code .ann, samp .ann { +.ann { /* type annotation - purple in the repl */ color: rebeccapurple; } +.autovar { + /* automatic variable names in the repl, e.g. # val1 */ + color: green; +} + /* Used on on the different-names page. */ th, td { diff --git a/www/public/tutorial/index.html b/www/public/tutorial/index.html index e2d8598314..cdfb56ca92 100644 --- a/www/public/tutorial/index.html +++ b/www/public/tutorial/index.html @@ -42,16 +42,32 @@ short.
The rockin’ roc replSo far, so good!
Try typing this at the REPL prompt and pressing enter:
+Try typing this at the REPL prompt and pressing Enter:
"Hello, World!"
The REPL should cheerfully display the following:
-"Hello, World!" : Str +"Hello, World!" : Str # val1Congratulations! You've just written your first Roc code!
-When you entered the expression "Hello, World!"
into the REPL,
+
When you entered the expression "Hello, World!"
,
the REPL printed it back out. It also printed : Str
, because
-Str
is the expression's type. We'll talk about types later; for now, let's ignore
-the :
and whatever comes after it whenever the REPL prints them.
Str
is that expression's type. We'll talk about types later; for now, let's ignore
+the :
and whatever comes after it whenever we see them.
+The REPL also printed # val1
at the end of the line.
+That means from now on you can use the variable name val1
to refer
+to the "Hello, World!"
expression you just entered. This comes in handy
+when entering complicated expressions! Future sections of the tutorial will omit these labels, since they're
+just there as a convenience.
Still, while we're talking about them, let's try it out. Put this into the repl and press Enter:
+val1
+You should see the same "Hello, World!"
line as before.
You can also create your own names for expressions. Try entering these lines:
+greeting = "Hi"
+audience = "World"
+"\(greeting), \(audience)!"
+After entering that last one, you should see this output:
+"Hi, World!" : Str # val2 +This
+Next let's try putting in a more complicated expression:
1 + 1 @@ -64,7 +80,7 @@ be grouped. -1 : Num *Let's try calling a function:
+Let's try calling a function:
>> Str.concat "Hi " "there!"
"Hi there!" : Str