Skip to content

Translate 'Variables' page #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
In the code below, each line corresponds to the item in the task list.
W kodzie poniżej, każda linia odpowiada podpunktowi w liście zadań.

```js run
let admin, name; // can declare two variables at once
let admin, name; // można zadeklarować dwie zmienne jednocześnie

name = "John";
name = "Jan";

admin = name;

alert( admin ); // "John"
alert( admin ); // "Jan"
```

10 changes: 5 additions & 5 deletions 1-js/02-first-steps/04-variables/1-hello-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 2

---

# Working with variables
# Praca ze zmiennymi

1. Declare two variables: `admin` and `name`.
2. Assign the value `"John"` to `name`.
3. Copy the value from `name` to `admin`.
4. Show the value of `admin` using `alert` (must output "John").
1. Zadeklaruj dwie zmienne: `admin` oraz `name`.
2. Przypisz wartość `"Jan"` do `name`.
3. Skopiuj wartość z `name` do `admin`.
4. Wyświetl wartość `admin` używając funkcji `alert` (musi wyświetlić "Jan").
18 changes: 9 additions & 9 deletions 1-js/02-first-steps/04-variables/2-declare-variables/solution.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## The variable for our planet
## Zmienna dla naszej planety

That's simple:
To proste:

```js
let ourPlanetName = "Earth";
let ourPlanetName = "Ziemia";
```

Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
Zauważ, że mogliśmy użyć krótszej nazwy `planet`, ale nie jest oczywiste, do jakiej planety się odnosimy. Dobrze jest być konkretnym. Przynajmniej dopóki nazwa nie jest za długa.

## The name of the current visitor
## Nazwa obecnego użytkownika

```js
let currentUserName = "John";
let currentUserName = "Jan";
```

Again, we could shorten that to `userName` if we know for sure that the user is current.
Znowu mogliśmy skrócić nazwę do `userName`, jeśli jesteśmy pewni, że dany użytkownik jest użytkownikiem bieżącym.

Modern editors and autocomplete make long variable names easy to write. Don't save on them. A name with 3 words in it is fine.
Współczesne edytory i autouzupełnianie ułatwiają pisanie długich nazw zmiennych. Nie oszczędzaj na nich. Nazwa składająca się z 3 wyrazów jest w porządku.

And if your editor does not have proper autocompletion, get [a new one](/code-editors).
Jeśli twój edytor nie ma odpowiedniego autouzupełniania, [spraw sobie nowy](/code-editors).
6 changes: 3 additions & 3 deletions 1-js/02-first-steps/04-variables/2-declare-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ importance: 3

---

# Giving the right name
# Nadawanie właściwych nazw

1. Create a variable with the name of our planet. How would you name such a variable?
2. Create a variable to store the name of a current visitor to a website. How would you name that variable?
1. Utwórz zmienną z nazwą naszej planety. Jak nazwać taką zmienną?
2. Utwórz zmienną do przechowywania nazwy obecnego gościa strony internetowej. Jak nazwać tę zmienną?
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
We generally use upper case for constants that are "hard-coded". Or, in other words, when the value is known prior to execution and directly written into the code.
Zazwyczaj wielkimi literami zapisujemy stałe, które są "zakodowane na sztywno". Lub, innymi słowy, gdy ich wartość jest znana przed wykonaniem programu i bezpośrednio zapisana w kodzie.

In this code, `birthday` is exactly like that. So we could use the upper case for it.
W tym kodzie `birthday` (pol. *data urodzenia*) jest dokładnie takim przypadkiem. Możemy więc użyć wielkich liter.

In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`: it is calculated, so we should keep the lower case for it.
W przeciwieństwie do niej, wartość `age` (pol. *wiek*) jest obliczana w czasie wykonywania programu. Dzisiaj mamy jeden wiek, a za rok będziemy mieli inny. Jest to stała w tym sensie, że nie zmienia się w trakcie wykonania kodu, ale jest trochę "mniej stała" niż `birthday`. Jest to wartość obliczana, więc powinniśmy pozostać przy małych literach.
12 changes: 6 additions & 6 deletions 1-js/02-first-steps/04-variables/3-uppercast-constant/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ importance: 4

---

# Uppercase const?
# Stała zapisana wielkimi literami?

Examine the following code:
Zbadaj poniższy kod:

```js
const birthday = '18.04.1982';

const age = someCode(birthday);
```

Here we have a constant `birthday` date and the `age` is calculated from `birthday` with the help of some code (it is not provided for shortness, and because details don't matter here).
Mamy tutaj stałą datę urodzenia `birthday` oraz wiek `age`, który jest obliczany na podstawie `birthday` za pomocą jakiegoś kodu (który nie jest podany dla uproszczenia, ponieważ szczegóły nie są tutaj istotne).

Would it be right to use upper case for `birthday`? For `age`? Or even for both?
Czy byłoby poprawne użycie wielkich liter dla `birthday`? Albo dla `age`? A może nawet dla obydwóch zmiennych?

```js
const BIRTHDAY = '18.04.1982'; // make uppercase?
const BIRTHDAY = '18.04.1982'; // wielkimi literami?

const AGE = someCode(BIRTHDAY); // make uppercase?
const AGE = someCode(BIRTHDAY); // wielkimi literami?
```

Loading