Skip to content

Flutter-Basic-To-Advanace/Basic_Dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 Dart Variables and Print Command

This section introduces the use of variables and how to print output in Dart.


πŸ“˜ Code Example 1: Hello World

void main() {
  print("Hello world");
}

Output:

Hello world

πŸ“˜ Code Example 2: Dart Variables and Printing

void main() {
  // Basic types
  int age = 21;
  double height = 5.9;
  String name = "Sharada";
  bool isStudent = true;

  // Printing
  print("Name: $name");
  print("Age: $age");
  print("Height: $height");
  print("Student: $isStudent");
}

Explanation:

  • int, double, String, and bool are basic data types in Dart.
  • Dart uses string interpolation ($variableName) to insert variable values into strings.
  • print() is used to display output.

Output:

Name: Sharada
Age: 21
Height: 5.9
Student: true

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages