mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
Translate functions
This commit is contained in:
parent
fb5dac4b3c
commit
7e3b7a5326
@ -17,53 +17,52 @@ zamykać w bloki klamrami.
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
-- 1. Primitive Datatypes and Operators
|
-- 1. Podstawowe typy danych oraz operatory
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
|
||||||
-- You have numbers
|
-- Mamy liczby
|
||||||
3 -- 3
|
3 -- 3
|
||||||
|
|
||||||
-- Math is what you would expect
|
-- Podstawowe działania działają tak, jak powinny
|
||||||
1 + 1 -- 2
|
1 + 1 -- 2
|
||||||
8 - 1 -- 7
|
8 - 1 -- 7
|
||||||
10 * 2 -- 20
|
10 * 2 -- 20
|
||||||
35 / 5 -- 7.0
|
35 / 5 -- 7.0
|
||||||
|
|
||||||
-- Division is not integer division by default
|
-- dzielenie domyślnie zwraca ,,dokładny'' wynik
|
||||||
35 / 4 -- 8.75
|
35 / 4 -- 8.75
|
||||||
|
|
||||||
-- integer division
|
-- dzielenie całkowitoliczbowe
|
||||||
35 `div` 4 -- 8
|
35 `div` 4 -- 8
|
||||||
|
|
||||||
-- Boolean values are primitives
|
-- wartości logiczne także są podstawowym typem danych:
|
||||||
True
|
True
|
||||||
False
|
False
|
||||||
|
|
||||||
-- Boolean operations
|
-- operacje logiczne: negacja oraz porównania
|
||||||
not True -- False
|
not True -- False
|
||||||
not False -- True
|
not False -- True
|
||||||
1 == 1 -- True
|
1 == 1 -- True
|
||||||
1 /= 1 -- False
|
1 /= 1 -- False
|
||||||
1 < 10 -- True
|
1 < 10 -- True
|
||||||
|
|
||||||
-- In the above examples, `not` is a function that takes one value.
|
-- W powyższych przykładach, `not` jest funkcją przyjmującą jeden argument.
|
||||||
-- Haskell doesn't need parentheses for function calls...all the arguments
|
-- Haskell nie potrzebuje nawiasów, by wywołać funkcję: argumenty są po prostu
|
||||||
-- are just listed after the function. So the general pattern is:
|
-- wypisywane jeden za drugim. Ogólnie wygląda to tak:
|
||||||
-- func arg1 arg2 arg3...
|
-- funkcja arg1 arg2 arg3...
|
||||||
-- See the section on functions for information on how to write your own.
|
-- Sekcja poświęcona funkcjom zawiera informacje, jak stworzyć własne.
|
||||||
|
|
||||||
-- Strings and characters
|
-- Łańcuchy znaków (stringi) i pojedyncze znaki:
|
||||||
"This is a string."
|
"To jest lancuch."
|
||||||
'a' -- character
|
'a' -- znak
|
||||||
'You cant use single quotes for strings.' -- error!
|
'Nie mozna laczyc apostrofow z lancuchami.' -- błąd!
|
||||||
|
|
||||||
-- Strings can be concatenated
|
-- Łańcuchy można sklejać
|
||||||
"Hello " ++ "world!" -- "Hello world!"
|
"Hello " ++ "world!" -- "Hello world!"
|
||||||
|
|
||||||
-- A string is a list of characters
|
-- Łańcuch jest listą własnych znaków
|
||||||
['H', 'e', 'l', 'l', 'o'] -- "Hello"
|
['H', 'e', 'l', 'l', 'o'] -- "Hello"
|
||||||
"This is a string" !! 0 -- 'T'
|
"To jest lancuch" !! 0 -- 'T'
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
-- Listy oraz krotki
|
-- Listy oraz krotki
|
||||||
|
Loading…
Reference in New Issue
Block a user