Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Défi : Déclaration de Variable | Commencer
Bases de C#

bookDéfi : Déclaration de Variable

Complétez le code en déclarant les variables value_1 et value_2 ayant respectivement les valeurs 10 et 20.

main.cs

main.cs

copy
12345678910111213141516
namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Write code below this line // Write code above this line System.Console.WriteLine("Value 1: " + value_1); System.Console.WriteLine("Value 2: " + value_2); } } }
  1. Utilisez le mot-clé var et l'opérateur d'affectation (=) pour la déclaration de variable.
main.cs

main.cs

copy
1234567891011121314151617
namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Write code below this line var value_1 = 10; var value_2 = 20; // Write code above this line System.Console.WriteLine("Value 1: " + value_1); System.Console.WriteLine("Value 2: " + value_2); } } }

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 9

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Can you show me how to declare the variables using the var keyword?

What is the correct syntax for assigning values to variables in JavaScript?

Can you provide an example of declaring and assigning these variables?

Awesome!

Completion rate improved to 1.59

bookDéfi : Déclaration de Variable

Glissez pour afficher le menu

Complétez le code en déclarant les variables value_1 et value_2 ayant respectivement les valeurs 10 et 20.

main.cs

main.cs

copy
12345678910111213141516
namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Write code below this line // Write code above this line System.Console.WriteLine("Value 1: " + value_1); System.Console.WriteLine("Value 2: " + value_2); } } }
  1. Utilisez le mot-clé var et l'opérateur d'affectation (=) pour la déclaration de variable.
main.cs

main.cs

copy
1234567891011121314151617
namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Write code below this line var value_1 = 10; var value_2 = 20; // Write code above this line System.Console.WriteLine("Value 1: " + value_1); System.Console.WriteLine("Value 2: " + value_2); } } }

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 9
some-alt