This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const counter = (state = 0, action) => { | |
switch (action.type) { | |
case 'INCREMENT': | |
return state += 1; | |
case 'DECREMENT': | |
return state -= 1; | |
default: | |
return state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fatorial($n) | |
{ | |
if ($n < 2) { // verifica se o '$n' atual e menor que 2 para que a recursao pare | |
return 1; // retorna o valor do caso base | |
} else { | |
return $n * fatorial($n-1); // faz a chamada recursiva para achar o fatorial do numero informado inicialmente | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define a funcao resolver | |
def resolver(argumento): | |
# verifica se a o texto/string informado nao e vazio e | |
# se o primeiro caractere e igual a '<' e o ultimo igual a '>' | |
return argumento.strip() != '' and (argumento[0] == '<' and argumento[-1] == '>') |