Select Git revision
14_ko.html 3.76 KiB
<!DOCTYPE html>
<html lang="ko">
<head>
<title>Rust 튜토리얼 - 자기주도프로젝트</title>
<meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/>
<meta http-equiv="Cache-Control" content="max-age=3600">
<link rel="stylesheet" href="tour.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/night-owl.min.css">
<script src="//unpkg.com/@highlightjs/cdn-assets@11.7.0/highlight.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="./site.webmanifest">
<script src="./tour.js" defer></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<div class="tour">
<div class="header">
<span class="title"><a href="index.html">Rust 튜토리얼</a></span>
<span class="nav">
<span class="toc"><a href="TOC_ko.html">목차</a></span>
</div>
<div class="page">
<h1>Multiple Return Values</h1>
<p>함수는 값의 <strong>튜플</strong>을 반환하여 여러 값을 반환할 수 있습니다.</p>
<p>튜플 요소는 인덱스 번호를 사용하여 참조할 수 있습니다.</p>
<p>Rust는 여러 형식의 destructuring을 지원합니다.
우리는 더 많은 형태로 볼 것이며, 이를 통해 데이터 구조의 하위 요소를 직관적으로 추출할 수 있습니다.</p>
<div class="bottomnav">
<span class="back"><a href="13_ko.html" rel="prev">❮ 이전</a></span>
<span class="next"><a href="15_ko.html" rel="next">다음 ❯</a></span>
</div>
</div>
<div class="code">
<iframe id="rust-playground" width="100%" src="https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn%20swap(x%3A%20i32%2C%20y%3A%20i32)%20-%3E%20(i32%2C%20i32)%20%7B%0A%20%20%20%20return%20(y%2C%20x)%3B%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20%2F%2F%20return%20a%20tuple%20of%20return%20values%0A%20%20%20%20let%20result%20%3D%20swap(123%2C%20321)%3B%0A%20%20%20%20println!(%22%7B%7D%20%7B%7D%22%2C%20result.0%2C%20result.1)%3B%0A%0A%20%20%20%20%2F%2F%20destructure%20the%20tuple%20into%20two%20variables%20names%0A%20%20%20%20let%20(a%2C%20b)%20%3D%20swap(result.0%2C%20result.1)%3B%0A%20%20%20%20println!(%22%7B%7D%20%7B%7D%22%2C%20a%2C%20b)%3B%0A%7D%0A" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals" title="Rust Playground" loading="lazy"></iframe>
</div>
</div>
<!-- <script>
document.addEventListener("DOMContentLoaded", function() {
// Select the widget's text element using its XPath
const xpath = '/html/body/main/div/div/div[1]/div[1]/div/button[1]/div';
const widgetText = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
// Change the text content of the element
widgetText.textContent = "New Text";
});
</script> -->
</body>
</html>