Si sinon déclaration
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
Poor Platypus
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
# For else is used whether a code is or is not broken with 'break'
for i in range(5):
if i == 3:
break
print(i)
else:
print("The code was not broken") # This code is not executed
for i in range(5):
if i == 7:
break
print(i)
else:
print("The code was not broken") # This code does execute
using System;
class NumbersNotDivisibleByThreeAndSeven
{
static void Main()
{
Console.WriteLine("Please enter your number: ");
int n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
if (i % 3 == 0)
{
continue;
}
else if (i % 7 ==0)
{
continue;
}
Console.Write("{0} ", i);
}
Console.WriteLine();
}
}