Skip to content
Snippets Groups Projects
Commit 3f85cbde authored by Alfex4936's avatar Alfex4936
Browse files

Update basic type

parent c43ab3d5
No related branches found
No related tags found
No related merge requests found
Pipeline #6458 passed
......@@ -39,7 +39,9 @@
<p>Rust는 숫자 변수 타입에 대해 알고 있어야하며, <code>u8</code><code>u32</code>로 쉽게 사용할 수 없습니다.</p>
<p>다행히 Rust는 <strong>as</strong> 키워드를 사용하여 숫자형을 쉽게 변환할 수 있습니다.</p>
<p>또는 <code>parse</code>를 자주 사용합니다.</p>
<pre><code class="rust">let my_string = "42"; let my_integer = my_string.parse::<i32>().unwrap(); // double colon op, ::<i32> syntax tells the compiler to parse the string as an i32 type</code></pre>
<pre><code class="rust">let my_string = "42";
let my_integer = my_string.parse::<i32>().unwrap();
// double colon op, ::<i32> syntax tells the compiler to parse the string as an i32 type</code></pre>
<div class="bottomnav">
<span class="back"><a href="11_ko.html" rel="prev">❮ 이전</a></span>
<span class="next"><a href="13_ko.html" rel="next">다음 ❯</a></span>
......
......@@ -42,20 +42,17 @@
<p>함수 이름은 항상 <code>snake_case</code>로 지정됩니다.</p>
<p>힌트: 함수를 정의하는 경우, 해당 함수가 수신하는 데이터를 매개변수 (parameter)라고합니다.<br />
그 함수를 호출하고 데이터를 전달하면 인수(argument)라고합니다.</p>
<pre><code class="python language-python">def add(x: int, y: int) -&gt; int:
return x + y
def subtract(x: int, y: int) -&gt; int:
return x - y
def main():
print(f"42 + 13 = {add(42, 13)}")
print(f"42 - 13 = {subtract(42, 13)}")
if __name__ == "__main__":
main()
</code></pre>
<p>```python # 파이썬으로 보면<br />
def add(x: int, y: int) -&gt; int:<br />
return x + y</p>
<p>def subtract(x: int, y: int) -&gt; int:<br />
return x - y</p>
<p>def main():<br />
print(f"42 + 13 = {add(42, 13)}")<br />
print(f"42 - 13 = {subtract(42, 13)}")</p>
<p>if <strong>name</strong> == "<strong>main</strong>":<br />
main()<br />
```</p>
<div class="bottomnav">
<span class="back"><a href="14_ko.html" rel="prev">❮ 이전</a></span>
<span class="next"><a href="16_ko.html" rel="next">다음 ❯</a></span>
......
......@@ -283,8 +283,11 @@
%rust%
let my_string = "42";
let my_integer = my_string.parse::<i32>().unwrap();
// double colon op, ::<i32> syntax tells the compiler to parse the string as an i32 type
%end%
- title: Constants
code: >-
......@@ -340,6 +343,7 @@
```python
# 파이썬으로 보면
def add(x: int, y: int) -> int:
return x + y
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment