Lyrics
Example 1: Hello World
console.log("Hello, World!");
// Example 2: Variable Declaration and Calculation
let x = 5;
let y = 10;
let sum = x + y;
console.log("The sum of x and y is: " + sum);
// Example 3: Conditional Statement
let age = 25;
if (age >= 18) {
console.log("You are an adult.");
} else {
console.log("You are a minor.");
}
// Example 4: Function
function square(num) {
return num * num;
}
let result = square(6);
console.log("The square of 6 is: " + result);
// Example 5: Array Manipulation
let fruits = ["apple", "banana", "orange"];
fruits.push("grape");
console.log("Fruits array: " + fruits);
// Example 1: Hello World
echo "Hello, World!";
// Example 2: Variable Declaration and Calculation
$x = 5;
$y = 10;
$sum = $x + $y;
echo "The sum of x and y is: " . $sum;
// Example 3: Conditional Statement
$age = 25;
if ($age >= 18) {
echo "You are an adult.";
} else {
echo "You are a minor.";
}
// Example 4: Function
function square($num) {
return $num * $num;
}
$result = square(6);
echo "The square of 6 is: " . $result;
// Example 5: Array Manipulation
$fruits = ["apple", "banana", "orange"];
array_push($fruits, "grape");
echo "Fruits array: " . implode(", ", $fruits);
// Example 1: Hello World
echo "Hello, World!";
// Example 2: Variable Declaration and Calculation
$x = 5;
$y = 10;
$sum = $x + $y;
echo "The sum of x and y is: " . $sum;
// Example 3: Conditional Statement
$age = 25;
if ($age >= 18) {
echo "You are an adult.";
} else {
echo "You are a minor.";
}
// Example 4: Function
function square($num) {
return $num * $num;
}
$result = square(6);
echo "The square of 6 is: " . $result;
// Example 5: Array Manipulation
$fruits = ["apple", "banana", "orange"];
array_push($fruits, "grape");
echo "Fruits array: " . implode(", ", $fruits);