Source code of my website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
personal_website/examples.html

64 lines
4.3 KiB

<code>inline</code>
<pre><code>nolang</code></pre>
<div class="sourceCode" id="cb5">
<pre class="sourceCode numberSource rust numberLines">
<code class="sourceCode rust">
<span id="cb5-1">
<a href="#cb5-1"></a>
<span class="kw">trait</span> MyPoly <span class="op">{</span>
</span>
<span id="cb5-2"><a href="#cb5-2"></a> <span class="kw">fn</span> member(<span class="op">&amp;</span><span class="kw">self</span>)<span class="op">;</span></span>
<span id="cb5-3"><a href="#cb5-3"></a><span class="op">}</span></span>
<span id="cb5-4"><a href="#cb5-4"></a><span class="kw">fn</span> part3<span class="op">&lt;</span>T<span class="op">:</span> MyPoly<span class="op">&gt;</span>(b<span class="op">:</span> T) <span class="op">{</span></span>
<span id="cb5-5"><a href="#cb5-5"></a> b<span class="op">.</span>member()<span class="op">;</span></span>
<span id="cb5-6"><a href="#cb5-6"></a><span class="op">}</span></span>
<span id="cb5-7"><a href="#cb5-7"></a><span class="kw">fn</span> part2<span class="op">&lt;</span>T<span class="op">:</span>MyPoly<span class="op">&gt;</span>(a<span class="op">:</span> T) <span class="op">{</span></span>
<span id="cb5-8"><a href="#cb5-8"></a> part3(a)<span class="op">;</span></span>
<span id="cb5-9"><a href="#cb5-9"></a><span class="op">}</span></span>
<span id="cb5-10"><a href="#cb5-10"></a><span class="kw">fn</span> part1() <span class="op">{</span></span>
<span id="cb5-11"><a href="#cb5-11"></a> part2(<span class="dv">123</span>)<span class="op">;</span></span>
<span id="cb5-12"><a href="#cb5-12"></a><span class="op">}</span></span>
<span id="cb5-13"><a href="#cb5-13"></a><span class="kw">fn</span> part0() <span class="op">{</span></span>
<span id="cb5-14"><a href="#cb5-14"></a> part1()<span class="op">;</span></span>
<span id="cb5-15"><a href="#cb5-15"></a><span class="op">}</span></span>
<span id="cb5-16"><a href="#cb5-16"></a><span class="kw">fn</span> main() <span class="op">{</span></span>
<span id="cb5-17"><a href="#cb5-17"></a> part0()<span class="op">;</span></span>
<span id="cb5-18"><a href="#cb5-18"></a><span class="op">}</span></span>
</code>
</pre>
</div>
<div class="sourceCode" id="cb3">
<pre class="sourceCode julia">
<code class="sourceCode julia">
<span id="cb3-1">
<a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>
vector <span class="op">=</span> [<span class="fl">1</span>, <span class="fl">2</span>]
</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>scalar <span class="op">=</span> <span class="fl">3</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>matrix <span class="op">=</span> [<span class="fl">4</span> <span class="fl">5</span>;<span class="fl">6</span> <span class="fl">7</span>]</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> el <span class="kw">in</span> vector</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">println</span>(el)</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> el <span class="kw">in</span> scalar</span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">println</span>(el)</span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> el <span class="kw">in</span> matrix</span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">println</span>(el)</span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span>
</span>
</code>
</pre>
</div>