Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Sheet Cheat

Java 8

if-elseif-else ​T
Ternary
ernary switch
SYNTAX Operator SYNTAX

​ (condition1) {
if
SYNTAX
​switch(condition) {
​ // block of code to be ​ case x:
variable = (condition) ?
executed if condition1 is ​ // code block…
expressionTrue :
true
EXAMPLE expressionFalse; EXAMPLE

int time = 22; int day = 4;


EXAMPLE


int time = 20; switch (day) {…
if (time < 10) {…

SOURCE ​String result = (time < SOURCE

Java If ... Else 18) ? "Good day " : "Good Java Switch
SOURCE
DEFINITIONTYPE DEFINITIONTYPE
Java Short Hand If...Else
if switch
(Ternary Operator)
TIPO DE ESTRUCTURA TIPO DE ESTRUCTURA
DEFINITIONTYPE
Estructuras de Control Estructuras de Control
Ternary Operator

TIPO DE ESTRUCTURA
Estructuras de Control

for-loop ​N
Nested
ested Loops for-each-loop
SYNTAX SYNTAX SYNTAX

​ or (statement 1;
for
f ​ Outer loop
// ​for (type variableName :
statement 2; statement 3) ​
for (statement 1; arrayName) {
{ statement 2; statement 3) ​ // code block to be
// code block to be { executed
EXAMPLE EXAMPLE EXAMPLE

for (int i = 0; i < 5; // Outer loop String[] cars = {"Volvo",


i++) { for (int i = 1; i <= 2; "BMW", "Ford", "Mazda"};
System.out.println(i); i++) {
} for (String car : cars)
SOURCE SOURCE SOURCE
Java For Loop Java For Loop Java For-Each Loop

DEFINITIONTYPE DEFINITIONTYPE DEFINITIONTYPE


for Nested Loops for-each-loop

TIPO DE ESTRUCTURA TIPO DE ESTRUCTURA TIPO DE ESTRUCTURA


Estructuras de Repeticion Estructuras de Repeticion Estructuras de Repeticion

while-loop ​d
do/while-loop
o/while-loop
SYNTAX SYNTAX


while (condition) { ​ {
do
​ // code block to be ​ // code block to be
executed executed
} }
EXAMPLE EXAMPLE

int i = 0; int i = 0;

while (i < 5) {… do {…

SOURCE SOURCE
Java While Loop Java While Loop

DEFINITIONTYPE DEFINITIONTYPE
while-loop do/while-loop

TIPO DE ESTRUCTURA TIPO DE ESTRUCTURA


Estructuras de Repeticion Estructuras de Repeticion

Javascript 4

if-elseif-else ​T
Ternary
ernary Ternary
SYNTAX Operator Operator(Multi-
​ f (condition1) {

if
i
// block of code to be
SYNTAX
SYNTAX
l ti )
variable = condition ?
executed if condition1 … variable = condition1 ?
expressionTrue :
expression1-condition1-
EXAMPLE expressionFalse;
true : condition2 ? …
const time = 22; EXAMPLE
EXAMPLE


//ONE EVALUATION:
if (time < 10) {… ​const hour = 10;

time = 20;

SOURCE ​

​const time = hour > 12 ?


JavaScript if else else if "Is afternoon" : hour >
SOURCE
SOURCE
DEFINITIONTYPE Operador condicional (ternario)
Operador condicional (ternario)
if - JavaScript | MDN
- JavaScript | MDN
TIPO DE ESTRUCTURA DEFINITIONTYPE
DEFINITIONTYPE
Estructuras de Control Ternary Operator
Ternary Operator
TIPO DE ESTRUCTURA
TIPO DE ESTRUCTURA
Estructuras de Control
Estructuras de Control

switch
statement
SYNTAX
S

switch(expression) {
case x:

​ …
// code block

EXAMPLE


const day = 4;


switch (day) {…

SOURCE
JavaScript Switch Statement

DEFINITIONTYPE
switch

TIPO DE ESTRUCTURA
Estructuras de Control

Python 3

if-elif-else ​T
Ternary
ernary switch
SYNTAX Operator EXAMPLE

​ f condition1:

if
i
SYNTAX

​ #code if condition1 is
#One line if statement:
true
if condition: #One line
DEFINITIONTYPE
EXAMPLE code to execute if
switch
condition is true
time = 22 TIPO DE ESTRUCTURA
EXAMPLE


#One line if statement:
Estructuras de Control
if time < 10:


print("Good morning ") ​
time = 20
SOURCE ​

Python Conditions
SOURCE
DEFINITIONTYPE Python Conditions
if
DEFINITIONTYPE
TIPO DE ESTRUCTURA
Ternary Operator
Estructuras de Control
TIPO DE ESTRUCTURA
Estructuras de Control

Kotlin 0

You might also like