Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Variable Declaration | Getting Started
C# Basics

bookChallenge: Variable Declaration

Complete the code by declaring the variables value_1 and value_2 having values 10 and 20 respectively.

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. Use the var keyword and the assignment operator (=) for variable declaration.
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); } } }

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 9

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

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

bookChallenge: Variable Declaration

Sveip for å vise menyen

Complete the code by declaring the variables value_1 and value_2 having values 10 and 20 respectively.

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. Use the var keyword and the assignment operator (=) for variable declaration.
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); } } }

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 9
some-alt