Skip to content

Instantly share code, notes, and snippets.

View dariogabriel113's full-sized avatar
:shipit:
...

Dario Gabriel dariogabriel113

:shipit:
...
  • FCPC - Fundação Cearense de Pesquisa e Cultura
  • Fortaleza - Brazil
View GitHub Profile
public class TestaCondicional2 {
public static void main(String[] args) {
System.out.println("testando condicionais");
int idade = 16;
int quantidadePessoas = 3;
boolean acompanhado = quantidadePessoas >= 2;
if (idade >= 18 && acompanhado) {
System.out.println("Seja bem vindo");
@dariogabriel113
dariogabriel113 / TestaCondicional.java
Last active June 30, 2018 04:25
Testando if e else
public class TestaCondicional {
public static void main(String[] args) {
System.out.println("testando condicionais");
int idade = 18;
int quantidadePessoas = 3;
if (idade >= 18) {
System.out.println("Você tem mais que 18 anos");
System.out.println("Seja bem vindo");
public class TestCharacter{
public static void main(String[] args){
char letter = 'a';
System.out.println(letter);
char value = 65; // It works!
System.out.println(value);
//value = (char) (value + 1); // Not works!
//System.out.println(value);
public class TestVariables {
public static void main(String[] args) {
int age = 37;
System.out.println("The age is " + age);
}
}
public class TestFloatingPoint{
public static void main(String[] args){
double salary = 1250.70;
System.out.println("My salary is " + salary);
double division = 5.0 / 2;
System.out.println("division: " + division);
}
}
public class TestConversion{
public static void main(String[] args){
float floatingPoint = 3.14f;
double salary = 1270.50;
int value = (int) salary;
System.out.println(value);
@dariogabriel113
dariogabriel113 / Program.java
Last active June 30, 2018 03:35
Hello World Java
public class Program{
public static void main(String[] args){
System.out.println("Hello world");
}
}
const makeRequest = () => {
return getJSON()
.then(data => {
if (data.needsAnotherRequest) {
return makeAnotherRequest(data)
.then(moreData => {
console.log(moreData)
return moreData
})
} else {
const makeRequest = async () => {
try {
// this parse may fail
const data = JSON.parse(await getJSON())
console.log(data)
} catch (err) {
console.log(err)
}
}
const makeRequest = () => {
try {
getJSON()
.then(result => {
// this parse may fail
const data = JSON.parse(result)
console.log(data)
})
// uncomment this block to handle asynchronous errors
// .catch((err) => {