Pratiquer l'Énumérateur
Remplissez les blancs pour compléter la définition de l'énumération. Lisez le code et déterminez quel est le nom de l'énumération, ainsi que les membres qu'elle doit avoir.
index.cs
12345678910111213141516171819202122232425262728293031323334353637using System; class Program { // Fill in the blanks below this line ___ ___ { ___ } static void Main(string[] args) { Potion potion = Potion.Invisibility; switch (potion) { case Potion.Invisibility: Console.WriteLine("You drink the Invisibility potion and vanish from sight!"); break; case Potion.Strength: Console.WriteLine("You drink the Strength potion and feel a surge of power!"); break; case Potion.Healing: Console.WriteLine("You drink the Healing potion and your wounds magically mend."); break; case Potion.FireResistance: Console.WriteLine("You drink the Fire Resistance potion and become impervious to flames."); break; case Potion.Teleportation: Console.WriteLine("You drink the Teleportation potion and find yourself in a new location!"); break; default: Console.WriteLine("Invalid potion type!"); break; } } }
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 11
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Awesome!
Completion rate improved to 2.04
Pratiquer l'Énumérateur
Glissez pour afficher le menu
Remplissez les blancs pour compléter la définition de l'énumération. Lisez le code et déterminez quel est le nom de l'énumération, ainsi que les membres qu'elle doit avoir.
index.cs
12345678910111213141516171819202122232425262728293031323334353637using System; class Program { // Fill in the blanks below this line ___ ___ { ___ } static void Main(string[] args) { Potion potion = Potion.Invisibility; switch (potion) { case Potion.Invisibility: Console.WriteLine("You drink the Invisibility potion and vanish from sight!"); break; case Potion.Strength: Console.WriteLine("You drink the Strength potion and feel a surge of power!"); break; case Potion.Healing: Console.WriteLine("You drink the Healing potion and your wounds magically mend."); break; case Potion.FireResistance: Console.WriteLine("You drink the Fire Resistance potion and become impervious to flames."); break; case Potion.Teleportation: Console.WriteLine("You drink the Teleportation potion and find yourself in a new location!"); break; default: Console.WriteLine("Invalid potion type!"); break; } } }
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 11