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
int fibonacci(int n) { | |
if(n == 0 || n == 1) return n; | |
return fibonacci(n - 1) + fibonacci(n - 2); | |
} | |
var result = fibonacci(20); |
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 name = 'Voyager I'; | |
var year = 1977; | |
var antennaDiameter = 3.7; | |
var flybyObjects = ['Jupiter', 'Saturn', 'Uranus', 'Neptune']; | |
var image = { | |
'tags': ['saturn'], | |
'url': '//path/to/saturn.jpg' | |
}; | |
if(year >= 2001) { |
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 name = 'Voyager I'; | |
var year = 1977; | |
var antennaDiameter = 3.7; | |
var flybyObjects = ['Jupiter', 'Saturn', 'Uranus', 'Neptune']; | |
var image = { | |
'tags': ['saturn'], | |
'url': '//path/to/saturn.jpg' | |
}; |
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 | |
$vet01 = array(); | |
$vet01[] = "Sistemas operacionais"; | |
$vet01[] = "Compiladores"; | |
$vet01[] = "Banco de dados"; | |
$vet02 = array(1, 2, 3, 4, 5); | |
$vet03 = array(0 => 0, 2 => 3, 10 => "item 10"); | |
$vet04 = ['valor 1', 'string 2', 3, 4.0, false]; | |
$vet05 = ["chave1" => 'valor 1', 2, 3, 4, array('item 1', 2 => 0.5)]; |
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
void main() { | |
for (int i = 0; i < 5; i++) { | |
print('Hello World ${i + 1}!'); | |
} | |
} |
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
class Estado { | |
List<String> posicoes | |
int nome | |
Estado pai | |
static constraints = { | |
pai nullable: true | |
} | |
} |
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
print("Hello, World!") |
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
mystring = "hello" | |
myfloat = 10.0 | |
myint = 20 | |
# testing code | |
if mystring == "hello": | |
print("String: %s" % mystring) | |
if isinstance(myfloat, float) and myfloat == 10.0: | |
print("Float: %f" % myfloat) | |
if isinstance(myint, int) and myint == 20: |
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
use (groovy.time.TimeCategory) { | |
//Example of Add Date 20 days from now | |
println new Date() | |
println 20.days.from.now | |
//Example of Add Date 3 months from now | |
println new Date() | |
println 3.months.from.now | |
//Example of Add Date 2 years from now |
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
public class TesteIR2 { | |
public static void main(String[] args) { | |
// De 1900.0 até 2800.0 o IR é de 7.5% e pode deduzir R$ 142 | |
// De 2800.01 até 3751.0 o IR é de 15% e pode deduzir R$ 350 | |
// De 3751.01 até 4664.00 o IR é de 22.5% e pode deduzir R$ 636 | |
double salario = 3800.0; | |
if (salario >= 1900.0 && salario <= 2800.0) { | |
System.out.println("A sua aliquota é de 7%"); |