Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit f0265d9

Browse files
committed
Merge pull request #33 from SimonSapin/indent
Switch the code example indentation to four spaces.
2 parents a10db16 + a1ad1e3 commit f0265d9

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

index.html

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,50 +48,50 @@ <h2>Featuring</h2>
4848
<button type="button" class="btn btn-primary btn-sm" id="run-code">Run</button>
4949
<div id="editor">// This code is editable and runnable!
5050
fn main() {
51-
// A simple integer calculator:
52-
// `+` or `-` means add/sub by 1
53-
// `*` or `/` means mul/div by 2
54-
55-
let program = "+ + * - /";
56-
let mut accumulator = 0;
57-
58-
for token in program.chars() {
59-
match token {
60-
'+' => accumulator += 1,
61-
'-' => accumulator -= 1,
62-
'*' => accumulator *= 2,
63-
'/' => accumulator /= 2,
64-
_ => { /* ignore everything else */ }
51+
// A simple integer calculator:
52+
// `+` or `-` means add/sub by 1
53+
// `*` or `/` means mul/div by 2
54+
55+
let program = "+ + * - /";
56+
let mut accumulator = 0;
57+
58+
for token in program.chars() {
59+
match token {
60+
'+' => accumulator += 1,
61+
'-' => accumulator -= 1,
62+
'*' => accumulator *= 2,
63+
'/' => accumulator /= 2,
64+
_ => { /* ignore everything else */ }
65+
}
6566
}
66-
}
67-
67+
6868
println!("The program \"{}\" calculates the value {}",
69-
program, accumulator);
69+
program, accumulator);
7070
}</div>
7171
<div id="result"></div>
7272
</div>
7373
<div id="static-code">
7474
<pre class='rust'>
7575
<span class='kw'>fn</span> main() {
76-
<span class='comment'>// A simple integer calculator:
77-
// `+` or `-` means add/sub by 1
78-
// `*` or `/` means mul/div by 2</span>
79-
80-
<span class='kw'>let</span> program = <span class='string'>"+ + * - /"</span>;
81-
<span class='kw'>let</span> <span class='kw'>mut</span> accumulator = <span class='number'>0</span>;
82-
83-
<span class='kw'>for</span> token in program.chars() {
84-
<span class='kw'>match</span> token {
85-
<span class='string'>'+'</span> => accumulator <span class='op'>+=</span> <span class='number'>1</span>,
86-
<span class='string'>'-'</span> => accumulator <span class='op'>-=</span> <span class='number'>1</span>,
87-
<span class='string'>'*'</span> => accumulator <span class='op'>*=</span> <span class='number'>2</span>,
88-
<span class='string'>'/'</span> => accumulator <span class='op'>/=</span> <span class='number'>2</span>,
89-
_ => { <span class='comment'>/* ignore everything else */</span> }
76+
<span class='comment'>// A simple integer calculator:
77+
// `+` or `-` means add/sub by 1
78+
// `*` or `/` means mul/div by 2</span>
79+
80+
<span class='kw'>let</span> program = <span class='string'>"+ + * - /"</span>;
81+
<span class='kw'>let</span> <span class='kw'>mut</span> accumulator = <span class='number'>0</span>;
82+
83+
<span class='kw'>for</span> token in program.chars() {
84+
<span class='kw'>match</span> token {
85+
<span class='string'>'+'</span> => accumulator <span class='op'>+=</span> <span class='number'>1</span>,
86+
<span class='string'>'-'</span> => accumulator <span class='op'>-=</span> <span class='number'>1</span>,
87+
<span class='string'>'*'</span> => accumulator <span class='op'>*=</span> <span class='number'>2</span>,
88+
<span class='string'>'/'</span> => accumulator <span class='op'>/=</span> <span class='number'>2</span>,
89+
_ => { <span class='comment'>/* ignore everything else */</span> }
90+
}
9091
}
91-
}
92-
93-
<span class='prelude-val'>println!</span>(<span class='string'>"The program \"{}\" calculates the value {}"</span>,
94-
program, accumulator);
92+
93+
<span class='prelude-val'>println!</span>(<span class='string'>"The program \"{}\" calculates the value {}"</span>,
94+
program, accumulator);
9595
}
9696
</pre>
9797
</div>

js/editor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ var editor = ace.edit("editor");
3737
var Range = ace.require('ace/range').Range;
3838
editor.setTheme("ace/theme/chrome");
3939
editor.getSession().setMode("ace/mode/rust");
40-
editor.getSession().setTabSize(2);
4140
editor.setShowPrintMargin(false);
4241
editor.renderer.setShowGutter(false);
4342
editor.setHighlightActiveLine(false);

0 commit comments

Comments
 (0)