Dart - Semicolons

Semicolons in Dart are mandatory. The semicolon acts as statements terminator. That is every statement must be ended with a semicolon(;).

Dart also allows multiple statements in a single line, exception that every statement must be ended by a semicolon(;). Otherwise a compile-time error will be raised by a compiler.

int x = 45;

String planet = 'Earth 🌏';

// double type
var weight = 52.22;

Every statement in above examples are ended by a semicolon.

In Dart, we can also write more than one statement on the same line, separated by semicolon(;). Check below provided example:

String name = 'Scarlett Johansson'; double height = 1.6;

Hope you like this!

Keep helping and happy 😄 coding

Avatar

A web geek, an industry experienced web developer & tutor/instructor residing in India 🇮🇳

Next
Previous

Related