✏️ Exercise 4 - Conditions
Introduction

⚠️ Avant de commencer cette quête, tu dois avoir terminé les quêtes suivantes :
💪 Défi
Exercice 1 : le plus mignon
Choisis l'animal le plus mignon parmi ces 3 possibilités : 🐼🐱🕷️
$cutestAnimal = ''; // copy your choice here
Crée une condition pour afficher la phrase correspondante, selon ton choix
- 🐼 : "You are right, pandas are so cuuute (and they can do kung fu !)"
- 🐱 : "Little kittens are cute too (just before scratching you slyly 🩹...)"
- 🕷️ : "Erk, you're a creepy one"
- Vide ou tout autre choix : "Please choose the cutest animal in this list 🐼🐱🕷️"
Exercice 2 : Protection de la biodiversité
La biodiversité est en danger.
- 🐱 : 1000000000 individus
- 🐼 : 1000 individus
- 🐘 : 150 individus
- 🦖 : 0 individu
Crée une condition pour afficher le bon statut de menace selon la population d'une espèce.
$animalPopulation = 0; // choose one of the value above
- si la population de l'animal est à zéro, l'animal est éteint (extinct)
- si la population de l'animal est < 200, l'animal est en danger critique (critically endangered)
- si la population de l'animal est < 3000, l'animal est menacé (threatened)
- plus >= 3000, la population n'est pas menacée.
Exercice 3 : Animaux dangereux
Voici quelques données sur la dangerosité de différents animaux
- 🐻 600kg, carnivore => dangereux
- 🐑 60kg, non carnivore => pas dangereux
- 🐘 1200kg, non carnivore => dangereux
- 🦔 1kg, carnivore => pas dangereux
- 🐇 3kg, non carnivore => pas dangereux
- 🦖 8000kg, carnivore => dangereux
$isCarnivorous = true; // if you choose 🐻
$weight = 600;
Crée une condition pour déterminer si un animal est dangereux ou non. Les règles sont :
- dangereux si l'animal est carnivore ET pèse plus de 50kg, OU s'il pèse plus de 1000kg. Affiche 'Ouch, you should run !'
- Dans tous les autres cas, affiche 'It is gentle as a lamb 🐑'
🧐 Critères d'acceptation
- [ ] Les conditions fonctionnent bien avec différentes valeurs
- [ ] Tu maîtrises la syntaxe des conditions
- [ ] Tu connais la différence entre if / elseif / else
Introduction

⚠️ Before starting this quest, you must have finished the following quests:
💪 Challenge
Exercice 1 : the cutest one
Choose the cutest animal between these 3 possibilities : 🐼🐱🕷️
$cutestAnimal = ''; // copy your choice here
Create condition to display the corresponding sentence, depending of your choice
- 🐼 : "You are right, pandas are so cuuute (and they can do kung fu !)"
- 🐱 : "Little kittens are cute too (just before scratching you slyly 🩹...)"
- 🕷️ : "Erk, you're a creepy one"
- Empty or any other choice : "Please choose the cutest animal in this list 🐼🐱🕷️"
Exercice 2 : Biodiversity protection
Biodiversity is in danger.
- 🐱 : 1000000000 individuals
- 🐼 : 1000 individuals
- 🐘 : 150 individuals
- 🦖 : 0 individual
Create a condition to display the correct threat status according to a species population.
$animalPopulation = 0; // choose one of the value above
- if the animal population is zero, animal is extinct
- if the animal population is < 200, animal is critically endangered
- if the animal population is < 3000, animal is threatened
- more >= 3000, population is not threatened.
Exercice 3 : Dangerous animals
Please find some data about various animals dangerosity
- 🐻 600kg, carnivorous => dangerous
- 🐑 60kg, not carnivorous => not dangerous
- 🐘 1200kg, not carnivorous => dangerous
- 🦔 1kg, carnivorous => not dangerous
- 🐇 3kg, not carnivorous => not dangerous
- 🦖 8000kg, carnivorous => dangerous
$isCarnivorous = true; // if you choose 🐻
$weight = 600;
Create a condition to determine if an animal is dangerous or not. The rules are :
- dangerous if the animal is carnivorous AND weights more than 50kg, OR if it weights more than 1000kg. Display 'Ouch, you should run !'
- In all other case, display 'It is gentle as a lamb 🐑'
🧐 Acceptance criteria
- [ ] Conditions works fine with different values
- [ ] You master the condition syntax
- [ ] You know the difference between if / elseif / else