CS-Notes/docs/_style/prism-master/examples/prism-ruby.html

30 lines
527 B
Java
Raw Normal View History

2018-12-19 14:09:39 +08:00
<h2>Comments</h2>
<pre><code># This is a comment
=begin
Multi-line
comment
=end</code></pre>
<h2>Strings</h2>
<pre><code>"foo \"bar\" baz"
'foo \'bar\' baz'</code></pre>
<h2>Regular expressions</h2>
<pre><code>/foo?[ ]*bar/</code></pre>
<h2>Variables</h2>
<pre><code>$foo = 5;
class InstTest
def set_foo(n)
@foo = n
end
def set_bar(n)
@bar = n
end
end</code></pre>
<h2>Symbols</h2>
<pre><code>mystring = :steveT;</code></pre>
<h2>String Interpolation</h2>
<pre><code>"foo #{'bar'+my_variable}"</code></pre>