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
Files.lines(Paths.get("/myfile.txt")).forEach(System.out::println); |
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
Imovel.find({}).remove(function() { | |
Imovel.create({ | |
name : 'Fazenda xoxa', | |
info : 'Fazenda em xoxa' | |
}, function(err, imovel){ | |
Imovel.create({ | |
name : 'Fazenda carapebus', | |
info : 'Fazenda em carapebus', | |
relacao: imovel | |
}) |
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
var factorial = function factorial_i(n) { | |
return (n > 1) ? n * factorial_i(n-1) : n; | |
}; | |
console.log(factorial(1)); //1 | |
console.log(factorial(2)); //2 | |
console.log(factorial(3)); //6 | |
console.log(factorial(4)); //24 | |
console.log(factorial(5)); //120 |
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
def factorial(n) | |
n>1 ? n * factorial(n-1) : n | |
end | |
puts factorial(1) # 1 | |
puts factorial(2) # 2 | |
puts factorial(3) # 6 | |
puts factorial(4) # 24 | |
puts factorial(5) # 120 |
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
def factorial | |
factorial = { it > 1 ? it * factorial(it-1) : it } | |
factorial(1) // 1 | |
factorial(2) // 2 | |
factorial(3) // 6 | |
factorial(4) // 24 | |
factorial(5) // 120 |
NewerOlder