From c623f9736dc00ca83e892b3a44eb64b9935c8d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darlan=20Mendon=C3=A7a?= Date: Fri, 14 Oct 2016 10:55:38 -0300 Subject: [PATCH 1/2] boolean article --- content/en/boolean.md | 25 +++++++++++++++++++++++++ content/pt-br/boolean.md | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 content/en/boolean.md create mode 100644 content/pt-br/boolean.md diff --git a/content/en/boolean.md b/content/en/boolean.md new file mode 100644 index 0000000..f77ea16 --- /dev/null +++ b/content/en/boolean.md @@ -0,0 +1,25 @@ +## Boolean + +The boolean type is very simple, they represent the values `true` and `false`, and we can give decisions with their two states. Imagine a variable who determine if a lamp is on or not. Or a variable what determine if a data is visible or not. Booleans serve to define these states. E.g: + +```js +var khalDrogoLive = false; +var khaleesiLive = true; +``` + +Like we have operators to work with Numbers, we have operators to do comparations, and check if is true or false. +Will see more about conditional operators in a future article, but now see some examples + +```js +// > greater than +var heightMountain = 2.06; +heightMountan > 2; +// return true +``` + +```js +// < less then +var heightMountain = 2.06; +heightMountan < 2; +// return false +``` diff --git a/content/pt-br/boolean.md b/content/pt-br/boolean.md new file mode 100644 index 0000000..443a066 --- /dev/null +++ b/content/pt-br/boolean.md @@ -0,0 +1,26 @@ +## Boolean + +O tipo boolean é um tipo bem simples, ele representa os valores `true` e `false`, e podemos tomar decisões com base nestes dois estados. Imagine uma variável que determina se uma lâmpada está ligada ou não. Ou uma variável que determina se um dado é visível ou não. Booleans servem para definir estes estados. São exemplos: + +```js +var khalDrogoLive = false; +var khaleesiLive = true; +``` + +Assim como temos operadores para trabalhar com Numbers, temos operadores para fazer comparações, e verificar se é verdadeiro ou falso. + +Veremos mais sobre operadores condicionais em outro artigo, mas por hora segue alguns exemplos + +```js +// > maior que +var heightMountain = 2.06; +heightMountan > 2; +// retorna true +``` + +```js +// < menor que +var heightMountain = 2.06; +heightMountan < 2; +// retorna false +``` From 9ffeaff91d7d9528f19f5ccb41b08e8d2f205e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darlan=20Mendon=C3=A7a?= Date: Fri, 14 Oct 2016 16:06:52 -0300 Subject: [PATCH 2/2] improve boolean article --- content/en/boolean.md | 16 +++++++++------- content/pt-br/boolean.md | 6 ++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/content/en/boolean.md b/content/en/boolean.md index f77ea16..0c2b1a9 100644 --- a/content/en/boolean.md +++ b/content/en/boolean.md @@ -1,25 +1,27 @@ ## Boolean -The boolean type is very simple, they represent the values `true` and `false`, and we can give decisions with their two states. Imagine a variable who determine if a lamp is on or not. Or a variable what determine if a data is visible or not. Booleans serve to define these states. E.g: +The boolean type is very simple, they represents two values `true` and `false`, we will use it to make decisions in our code. Think in a variable who detemine if a lamb is connected. Or a variable that determines whether the user has access to a resource or not. Booleans + +Imagine uma variável que determina se uma lâmpada está ligada ou não. Ou uma variável que determina se o usuário tem acessou ou não a um recurso. Booleans are created by direct assignment: ```js var khalDrogoLive = false; var khaleesiLive = true; ``` -Like we have operators to work with Numbers, we have operators to do comparations, and check if is true or false. -Will see more about conditional operators in a future article, but now see some examples +Or we can use conditional operators for the return a boolean: ```js -// > greater than +// > maior que var heightMountain = 2.06; heightMountan > 2; -// return true +// retorna true ``` ```js -// < less then +// < menor que var heightMountain = 2.06; heightMountan < 2; -// return false +// retorna false ``` + diff --git a/content/pt-br/boolean.md b/content/pt-br/boolean.md index 443a066..70aba6a 100644 --- a/content/pt-br/boolean.md +++ b/content/pt-br/boolean.md @@ -1,15 +1,13 @@ ## Boolean -O tipo boolean é um tipo bem simples, ele representa os valores `true` e `false`, e podemos tomar decisões com base nestes dois estados. Imagine uma variável que determina se uma lâmpada está ligada ou não. Ou uma variável que determina se um dado é visível ou não. Booleans servem para definir estes estados. São exemplos: +O tipo boolean é um tipo bem simples, ele representa os valores `true` e `false`, nós iremos usá-lo para tomar decisões em nosso código. Imagine uma variável que determina se uma lâmpada está ligada ou não. Ou uma variável que determina se o usuário tem acessou ou não a um recurso. Booleans são criados por atribuição direta: ```js var khalDrogoLive = false; var khaleesiLive = true; ``` -Assim como temos operadores para trabalhar com Numbers, temos operadores para fazer comparações, e verificar se é verdadeiro ou falso. - -Veremos mais sobre operadores condicionais em outro artigo, mas por hora segue alguns exemplos +Ou podemos utilizar operadores condicionais para nos retornar um boolean: ```js // > maior que