Menu
Coddy logo textTech

What are Variables?

Part of the Fundamentals section of Coddy's Dart journey — lesson 5 of 94.

Variables store data in your program. Create them by specifying type, name, and value:

void main() {
  String name = 'Dart Programmer';
  print(name);
}

Variables can be referenced and modified throughout your code:

void main() {
  String language = 'Dart';
  print('I am learning ' + language);
  
  language = 'Dart programming';
  print('I am learning ' + language);
}

Cheat sheet

Variables store data in your program. Create them by specifying type, name, and value:

String name = 'Dart Programmer';

Variables can be referenced and modified throughout your code:

String language = 'Dart';
print('I am learning ' + language);

language = 'Dart programming';
print('I am learning ' + language);

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals