-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlesson-18-for-loops.pot
225 lines (196 loc) · 7.09 KB
/
lesson-18-for-loops.pot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Translations template for Learn GDScript From Zero.
# Copyright (C) 2024 GDQuest
# This file is distributed under the same license as the Learn GDScript From
# Zero project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Learn GDScript From Zero \n"
"Report-Msgid-Bugs-To: https://github.com/GDQuest/learn-gdscript\n"
"POT-Creation-Date: 2024-12-12 14:39+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.1\n"
#: course/lesson-18-for-loops/lesson.tres:14
msgid ""
"In the last lesson, we looked at [code]while[/code] loops. We found they "
"were useful if we don't know how many times we should repeat code. \n"
"\n"
"However, they could result in infinite loops if we're not careful.\n"
"\n"
"The loop below never ends because we never increment [code]number[/code]."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:38
msgid ""
"There's a safer and often easier kind of loop: the [code]for[/code] loop."
"\n"
"\n"
"We'll look at it in this lesson.\n"
"\n"
"Unlike [code]while[/code] loops, [code]for[/code] loops don't run "
"infinitely, so it's much less likely that you'll get bugs in your game. "
"[b]We recommend favoring for loops over while loops because of this[/b]."
"\n"
"\n"
"Let's change the code above to use a [code]for[/code] loop instead.\n"
"\n"
"The loop below will change the [code]cell[/code] three times."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:66
msgid "Let's explain what's going on here."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:74
msgid "The range() function"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:76
msgid ""
"Godot has the helper function [code]range()[/code]. Calling "
"[code]range(n)[/code] creates a list of numbers from [code]0[/code] to "
"[code]n - 1[/code]. \n"
"\n"
"So calling [code]range(3)[/code] outputs the list of numbers [code][0, 1,"
" 2][/code], and [code]range(5)[/code] outputs [code][0, 1, 2, 3, "
"4][/code]."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:86
msgid "What list of numbers would range(6) create?"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:87
msgid "What would [code]print(range(6))[/code] print to the console?"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:89
msgid ""
"The function [code]range(n)[/code] creates a list of numbers from "
"[code]0[/code] to [code]n - 1[/code]. The output list will start with "
"[code]0[/code] and end with [code]5[/code].\n"
"\n"
"So calling [code]range(6)[/code] will output a list of six numbers which "
"are [code][0, 1, 2, 3, 4, 5][/code].\n"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:93
#: course/lesson-18-for-loops/lesson.tres:94
msgid "[0, 1, 2, 3, 4, 5]"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:93
msgid "[1, 2, 3, 4, 5, 6]"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:93
msgid "[0, 1, 2, 3, 4, 5, 6]"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:101
msgid "How for loops work"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:103
msgid ""
"In a [code]for[/code] loop, the computer takes each value inside a list, "
"stores it in a temporary variable, and executes the code in the loop once"
" per value."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:123
msgid ""
"In the above example, for each item in the list [code][0, 1, 2][/code], "
"Godot sets [code]number[/code] to the item, then executes the code in the"
" [code]for[/code] loop.\n"
"\n"
"We'll explain arrays more thoroughly in the next lesson, but notice that "
"[code]number[/code] is just a temporary variable. You create it when "
"defining the loop, and the loop takes care of changing its value. Also, "
"you can name this variable anything you want.\n"
"\n"
"This code behaves the same as the previous example:"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:147
msgid ""
"In both examples, we print the value of the temporary variable we "
"created: [code]number[/code] in the first example and "
"[code]element[/code] in the second.\n"
"\n"
"As Godot moves through the loop, it assigns each value of the array to "
"that variable. First, it sets the variable to [code]0[/code], then to "
"[code]1[/code], and finally, to [code]2[/code].\n"
"\n"
"We can break down the instructions the loop runs. You can see how a loop "
"is a shortcut to code that otherwise gets very long."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:171
msgid ""
"We can put whatever code we like in the loop's code block, including "
"other function calls like [code]draw_rectangle()[/code]."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:179
msgid "Using a for loop instead of a while loop"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:181
msgid ""
"Here's our old [code]move_to_end()[/code] function which used a "
"[code]while[/code] loop."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:201
msgid ""
"If we use a [code]for[/code] loop instead, the code becomes a little "
"simpler."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:221
msgid ""
"Rather than constantly checking if the robot reached the end of the "
"board, with the [code]for[/code] loop, we take the board's width "
"beforehand, then move the robot a set amount of times.\n"
"\n"
"The function still works the same. You can execute it below."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:243
msgid ""
"In the practices, we'll use [code]for[/code] loops in different ways to "
"get you used to using them."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:251
msgid "Using a for loop to move to the end of the board"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:252
msgid ""
"Once again, the robot has decided to stand at the top of the board.\n"
"\n"
"This time, use a [code]for[/code] loop in the "
"[code]move_to_bottom()[/code] function to have it move to the bottom of "
"the board.\n"
"\n"
"The board size is determined by the [code]Vector2[/code] variable "
"[code]board_size[/code].\n"
"\n"
"The robot's starting cell is [code]Vector2(2, 0)[/code]."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:268
msgid ""
"Use a for loop to have our robot move from the top of the board to the "
"bottom."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:273
msgid "Improving code with a for loop"
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:274
msgid ""
"Use a [code]for[/code] loop to remove the duplicate code in the "
"[code]run()[/code] function.\n"
"\n"
"In this practice, we revisit the turtle and drawing rectangles.\n"
"\n"
"With our new knowledge of [code]for[/code] loops, we can condense this "
"code to take up less space and make it easier to modify.\n"
"\n"
"The turtle should draw three squares in a horizontal line. The squares "
"should be 100 pixels apart."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:297
msgid ""
"In the past we had to copy and paste code to draw multiple rectangles. "
"Let's revisit previous code and improve it with a for loop."
msgstr ""
#: course/lesson-18-for-loops/lesson.tres:301
msgid "Introduction to For Loops"
msgstr ""