@@ -12,15 +12,15 @@ prints the text `Hello, world!` to the screen, so we’ll do the same here!
12
12
> team has been focusing on enabling great IDE support via ` rust-analyzer ` . See
13
13
> [ Appendix D] [ devtools ] <!-- ignore --> for more details.
14
14
15
- ### Creating a Project Directory
15
+ ### Membuat Direktori Proyek
16
16
17
17
You’ll start by making a directory to store your Rust code. It doesn’t matter
18
18
to Rust where your code lives, but for the exercises and projects in this book,
19
- we suggest making a * projects * directory in your home directory and keeping all
19
+ we suggest making a _ projects _ directory in your home directory and keeping all
20
20
your projects there.
21
21
22
- Open a terminal and enter the following commands to make a * projects * directory
23
- and a directory for the “Hello, world!” project within the * projects * directory.
22
+ Open a terminal and enter the following commands to make a _ projects _ directory
23
+ and a directory for the “Hello, world!” project within the _ projects _ directory.
24
24
25
25
For Linux, macOS, and PowerShell on Windows, enter this:
26
26
@@ -40,14 +40,14 @@ For Windows CMD, enter this:
40
40
> cd hello_world
41
41
```
42
42
43
- ### Writing and Running a Rust Program
43
+ ### Menulis dan Menjalankan Program Rust
44
44
45
- Next, make a new source file and call it * main.rs * . Rust files always end with
46
- the * .rs * extension. If you’re using more than one word in your filename, the
45
+ Next, make a new source file and call it _ main.rs _ . Rust files always end with
46
+ the _ .rs _ extension. If you’re using more than one word in your filename, the
47
47
convention is to use an underscore to separate them. For example, use
48
- * hello_world.rs * rather than * helloworld.rs * .
48
+ _ hello_world.rs _ rather than _ helloworld.rs _ .
49
49
50
- Now open the * main.rs * file you just created and enter the code in Listing 1-1.
50
+ Now open the _ main.rs _ file you just created and enter the code in Listing 1-1.
51
51
52
52
<span class =" filename " >Filename: main.rs</span >
53
53
@@ -60,7 +60,7 @@ fn main() {
60
60
<span class =" caption " >Listing 1-1: A program that prints ` Hello, world! ` </span >
61
61
62
62
Save the file and go back to your terminal window in the
63
- * ~ /projects/hello_world * directory. On Linux or macOS, enter the following
63
+ _ ~ /projects/hello_world _ directory. On Linux or macOS, enter the following
64
64
commands to compile and run the file:
65
65
66
66
``` console
@@ -85,7 +85,7 @@ section for ways to get help.
85
85
If ` Hello, world! ` did print, congratulations! You’ve officially written a Rust
86
86
program. That makes you a Rust programmer—welcome!
87
87
88
- ### Anatomy of a Rust Program
88
+ ### Anatomi dari Program Rust
89
89
90
90
Let’s review this “Hello, world!” program in detail. Here’s the first piece of
91
91
the puzzle:
@@ -136,7 +136,7 @@ Fourth, we end the line with a semicolon (`;`), which indicates that this
136
136
expression is over and the next one is ready to begin. Most lines of Rust code
137
137
end with a semicolon.
138
138
139
- ### Compiling and Running Are Separate Steps
139
+ ### Mengkompilasi dan Menjalankan Adalah Langkah yang Berbeda
140
140
141
141
You’ve just run a newly created program, so let’s examine each step in the
142
142
process.
@@ -171,24 +171,24 @@ main.pdb
171
171
main.rs
172
172
```
173
173
174
- This shows the source code file with the * .rs * extension, the executable file
175
- (* main.exe * on Windows, but * main * on all other platforms), and, when using
176
- Windows, a file containing debugging information with the * .pdb * extension.
177
- From here, you run the * main * or * main.exe * file, like this:
174
+ This shows the source code file with the _ .rs _ extension, the executable file
175
+ (_ main.exe _ on Windows, but _ main _ on all other platforms), and, when using
176
+ Windows, a file containing debugging information with the _ .pdb _ extension.
177
+ From here, you run the _ main _ or _ main.exe _ file, like this:
178
178
179
179
``` console
180
180
$ ./main # or .\main.exe on Windows
181
181
```
182
182
183
- If your * main.rs * is your “Hello, world!” program, this line prints `Hello,
183
+ If your _ main.rs _ is your “Hello, world!” program, this line prints `Hello,
184
184
world!` to your terminal.
185
185
186
186
If you’re more familiar with a dynamic language, such as Ruby, Python, or
187
187
JavaScript, you might not be used to compiling and running a program as
188
- separate steps. Rust is an * ahead -of-time compiled * language, meaning you can
188
+ separate steps. Rust is an _ ahead -of-time compiled _ language, meaning you can
189
189
compile a program and give the executable to someone else, and they can run it
190
- even without having Rust installed. If you give someone a * .rb * , * .py * , or
191
- * .js * file, they need to have a Ruby, Python, or JavaScript implementation
190
+ even without having Rust installed. If you give someone a _ .rb _ , _ .py _ , or
191
+ _ .js _ file, they need to have a Ruby, Python, or JavaScript implementation
192
192
installed (respectively). But in those languages, you only need one command to
193
193
compile and run your program. Everything is a trade-off in language design.
194
194
0 commit comments