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 makeRequest = async () => { | |
try { | |
const data = JSON.parse(await getJSON()) | |
console.log(data) | |
} catch (err) { | |
console.log(err) | |
} | |
} |
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 list = ['Groovy', 'Grails', 'Java'] | |
println(list.count { it.startsWith('G') } == 2) | |
Integer[] numbers = [1,2,3,4] as Integer[] | |
println(numbers.count { it > 2 } == 2) | |
def map = [user: 'dariogabriel113', city: 'Fortaleza', age: 23] | |
println(map.count { key, value -> key.size() == 3 } == 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
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' | |
}; | |
flybyObjects.where((name) => name.contains('turn')).forEach(print); |
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
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
print("Hello, World!") |
NewerOlder