feat: added cleanscript
This commit is contained in:
19
ch06/ch06-00-enums.html
Normal file
19
ch06/ch06-00-enums.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Enums and Pattern Matching</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="enums-and-pattern-matching"><a class="header" href="#enums-and-pattern-matching">Enums and Pattern Matching</a></h1>
|
||||
<p>In this chapter, we’ll look at enumerations, also referred to as <em>enums</em>.
|
||||
Enums allow you to define a type by enumerating its possible variants. First
|
||||
we’ll define and use an enum to show how an enum can encode meaning along with
|
||||
data. Next, we’ll explore a particularly useful enum, called <code>Option</code>, which
|
||||
expresses that a value can be either something or nothing. Then, we’ll look at
|
||||
how pattern matching in the <code>match</code> expression makes it easy to run different
|
||||
code for different values of an enum. Finally, we’ll cover how the <code>if let</code>
|
||||
construct is another convenient and concise idiom available to handle enums in
|
||||
your code.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user