Skip to main content
← Chapter 1: The Dart Basics Lesson 1.5

Operators

Recommended Time: 1 day

Operators are an essential part of programming. They enable us to manipulate data in a variety of ways.

Dart includes a large number of built-in operators for performing various types of operations. Unary operators take only one operand, whereas binary operators take two operands. There are various kinds of operators: arithmetic (+, -, *, /, ~/, %), equality and relational (==, !=, >, <=), type test (is, as), assignment (=, +=, ??=), logical (&&, ||, !), bitwise, conditional (condition ? a : b and a ?? b) and cascade (..). Use the resources below to learn each of them.

Projects

1. Get Sum of Two Numbers

Write a program to calculate the sum of two numbers.

  • Store both numbers in variables
  • Store the answer in a variable and display the answer.

2. Temperature Converter

Write a program that converts a temperature from Fahrenheit to Celsius, and then prints the result to the console. The formula for converting a temperature from Fahrenheit to Celsius is:

C = (F - 32) * 5/9

Note: Don’t forget to post your solutions to your GitHub profile and share.

Resources