Author: admin
-
Char lists
A char list is nothing more than a list of characters. Consider the following program to understand the same. The above program generates the following result − Instead of containing bytes, a char list contains the code points of the characters between single-quotes. So while the double-quotes represent a string (i.e. a binary), singlequotes represent a…
-
Lists (Basic Operations)
In this chapter, we will discuss how to carry out some basic operations on Lists, such as − Sr.No Basic Operation & Description 1 Inserting Elements into a ListMutable Lists can grow dynamically at runtime. The List.add() function appends the specified value to the end of the List and returns a modified List object. 2 Updating a…
-
Lists
A very commonly used collection in programming is an array. Dart represents arrays in the form of List objects. A List is simply an ordered group of objects. The dart:core library provides the List class that enables creation and manipulation of lists. The logical representation of a list in Dart is given below − Lists can be classified as − Let us…
-
Boolean
Dart provides an inbuilt support for the Boolean data type. The Boolean data type in DART supports only two values – true and false. The keyword bool is used to represent a Boolean literal in DART. The syntax for declaring a Boolean variable in DART is as given below − Example It will produce the…
-
Strings
Strings in Elixir are inserted between double quotes, and they are encoded in UTF-8. Unlike C and C++ where the default strings are ASCII encoded and only 256 different characters are possible, UTF-8 consists of 1,112,064 code points. This means that UTF-8 encoding consists of those many different possible characters. Since the strings use utf-8,…
-
String
The String data type represents a sequence of characters. A Dart string is a sequence of UTF 16 code units. String values in Dart can be represented using either single or double or triple quotes. Single line strings are represented using single or double quotes. Triple quotes are used to represent multi-line strings. The syntax…
-
Numbers
Dart numbers can be classified as − The num type is inherited by the int and double types. The dart core library allows numerous operations on numeric values. The syntax for declaring a number is as given below − Example It will produce the following output − Note − The Dart VM will throw an exception if fractional values are assigned to integer variables. Parsing The parse() static…
-
Decision Making
Decision making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the general from…
-
Pattern Matching
Pattern matching is a technique which Elixir inherits form Erlang. It is a very powerful technique that allows us to extract simpler substructures from complicated data structures like lists, tuples, maps, etc. A match has 2 main parts, a left and a right side. The right side is a data structure of any kind. The left side attempts to…
-
Decision Making
A conditional/decision-making construct evaluates a condition before the instructions are executed. Conditional constructs in Dart are classified in the following table. Sr.No Statement & Description 1 if statementAn if statement consists of a Boolean expression followed by one or more statements. 2 If…Else StatementAn if can be followed by an optional else block. The else block will execute if the Boolean expression tested by…