Characteristics of Darts

Dart is a modern and full featured language. Dart also has many similarities with other well-known languages such as Java, C #, Javascript, Swift, and Kotlin. One of the main designs of Dart is that this language is familiar to Javascript and Java / C # developers. That is, those who are familiar with both languages can start learning Dart easily. However, if you are a prospective developer who is just starting to learn programming and deciding Dart as a first language, take it easy. Darts are a language that is comfortable and easy to learn to start programming.

We take the following example of the Dart code snippet:

  1. main() {
  2.   var name = 'Dicoding';
  3.   String language = 'Dart';
  4.   print('Hello $name. Welcome to $language!'); }

If you are familiar with other programming languages such as Java, Kotlin, or Swift, of course you already understand how the above code works. So, the code above will display "Hello Dicoding. Welcome to Dart! " on the console.

Darts as a language have the following characteristics:

Statically typed,
Type inference,
String expressions,
Multi-paradigm: OOP & Functional.
Darts are statically typed languages, meaning we need to define variables before we can use them. The following code snippet is an example of a variable declaration on Dart.

  1. var name = 'Dicoding';
  2. String language = 'Dart';

It can be seen that on Dart we don't need to explicitly define variable data types. This is because Dart also supports inference types, where data types will be automatically detected when a variable is initialized. For example the name variable above will be detected as a String. In addition, Dart also has dynamic variables. What is that? We will explore this topic in the variable module.

  1. print('Hello $name. Welcome to $language!');

The code above also shows that Dart has a String interpolation feature. This is a feature where we can insert variables into a String object without concatenation (merging String objects using +). With this feature, of course, it becomes easier to create dynamic String objects.

Related Posts

MMU Menerima Content Placement Dan Back Link
Terimakasih Telah berkunjung , Ada yang bisa saya bantu? ...
Chat Sekarang