Lesson 1 of 51 beginner

What is Programming?

Teaching Computers to Think

Open interactive version (quiz + challenge)

Real-world analogy

Programming is like writing a recipe for a robot chef. The robot can cook anything, but it needs EXACT step-by-step instructions. If you write 'add some salt,' it panics! You must say 'add 1 teaspoon of salt.' Code is just very precise instructions for a computer.

What is it?

Programming is the art of writing instructions (code) that a computer can understand and execute. You write code in a programming language like Dart, and the computer follows your instructions exactly. Every app, game, and website you use was built by someone writing code.

Real-world relevance

Everything digital runs on code. When you open Instagram, play a mobile game, or ask Siri a question, code is running behind the scenes. Learning to program means you can CREATE these things, not just use them. It is one of the most valuable skills in the world.

Key points

Code example

// Your very first Dart program!
// Every Dart app starts with a main() function

void main() {
  // Step 1: Store some data
  var myName = 'Flutter Learner';
  var myAge = 10;

  // Step 2: Process it
  var greeting = 'Hello, I am ' + myName;

  // Step 3: Output the result
  print(greeting);
  print('I am ' + myAge.toString() + ' years old');
  print('I am learning to code!');
}

Line-by-line walkthrough

  1. 1. A comment explaining this is your first Dart program
  2. 2. A comment explaining that every Dart app needs a main() function
  3. 3.
  4. 4. The main() function -- this is where your program starts running
  5. 5. Opening curly brace starts the function body
  6. 6. A comment for Step 1
  7. 7. Creating a variable called myName and storing the text 'Flutter Learner'
  8. 8. Creating a variable called myAge and storing the number 10
  9. 9.
  10. 10. A comment for Step 2
  11. 11. Creating a greeting by joining 'Hello, I am ' with the myName variable
  12. 12.
  13. 13. A comment for Step 3
  14. 14. Printing the greeting to the screen
  15. 15. Printing age -- we use .toString() to convert the number to text for joining
  16. 16. Printing an encouraging message
  17. 17. Closing curly brace ends the main function

Spot the bug

void main() {
  var name = 'Dart'
  print('Hello, ' + name)
}
Need a hint?
Dart requires something at the end of every statement...
Show answer
Missing semicolons! Every statement in Dart must end with a semicolon (;). Fix: var name = 'Dart'; and print('Hello, ' + name);

Explain like I'm 5

Imagine you have a super-fast robot friend who can do anything, but it only understands very specific instructions. If you say 'make me food,' it just stares at you. But if you say 'open the fridge, take out bread, put peanut butter on it, close the bread,' it makes you a perfect sandwich! Programming is writing those exact instructions for your computer robot friend.

Fun fact

The first computer programmer in history was Ada Lovelace, a woman who wrote programs in the 1840s -- almost 100 years before modern computers existed! The Dart language was created by Google in 2011.

Hands-on challenge

Open any text editor and type: print('Hello, my name is [YOUR NAME]!'); -- replace [YOUR NAME] with your actual name. Congratulations, you just wrote your first line of code!

More resources

Open interactive version (quiz + challenge) ← Back to course: Flutter & Dart