30 lines
527 B
HTML
30 lines
527 B
HTML
|
<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>
|