Found 26504 Articles for Server Side Programming

Constructors in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:45:25

1K+ Views

Constructors are methods that are used to initialize an object when it gets created. Constructors are mainly used to set the initial values for instance variables. The name of the constructor is the same as the name of the class.Constructors are similar to instance methods but they do not have a return type.All classes in Dart have their own default constructor, if you don't create any constructor for a class, the compiler will implicitly create a default constructor for every class by assigning the default values to the member variables.We can create a constructor in Dart something like this −class ... Read More

const keyword in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:44:52

751 Views

Dart provides us with two ways in which we can declare variables with fixed values. One of them is by declaring a variable with a const keyword, and the other is by declaring the variable with a final keyword.It should be noted that both of them does provide an assurance that once a value is assigned to the variable with them, it won't change, but indeed they are slightly different from one another.constA variable that is declared using the const keyword cannot be assigned any other value. Also, the variable is known as a compile-time constant, which in turn means that ... Read More

Comments in Rust Programming

Mukul Latiyan
Updated on 21-May-2021 12:26:33

860 Views

Comments in Rust are statements that are ignored by both the rust compiler and interpreter. They are mainly used for human understanding of the code.Generally, in programming, we write comments to explain the working of different functions or variables or methods to whosoever is reading our code.Comments enhance the code readability, especially when the identifiers in the code are not named properly.In Rust, there are multiple ways in which we can declare comments. Mainly these are −Single-line commentsMulti-line commentsDoc commentsIn this article, we will explore all the three comments.Single-Line commentSingle line comments in Rust are comments that extend up to ... Read More

Comments in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:25:35

421 Views

Comments are a set of commands that are ignored by the compiler. They are used in a scenario where you want to attach a note to your code or a section of code so that when you visit it later, you can recall it easily.The comment statements are usually ignored during the execution of the program.There are multiple types of comments in Dart, mainly these are −Single line commentsMulti-line commentsDocumentation commentsWe will explore all the above document types in this article.Single Line commentsSingle line comments make use of // (double forward slash). They extend up to a new line character.Syntax// ... Read More

Cascade notation in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:24:22

1K+ Views

Cascade notation is used when we want to operate a sequence of operations on the same object. The cascade notation is denoted by the (..) symbol.It is similar to method chaining that we have in other programming languages and it does save us plenty of steps and need of temporary variable.ExampleConsider the following example for a representation of how the cascade notation works in Dart. Live Democlass Sample{    var a;    var b;    void showA(x){       this.a = x;    }    void showB(y){       this.b = y;    }    void printValues(){     ... Read More

Break statement in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:24:46

255 Views

The break statement is used when we want to break or terminate the execution of a loop. Once the break statement is reached the control is transferred from the current loop to whatever is written after the loop.It is mostly used in the conditional statement and also in loops of all types. It is present in almost all popular programming languages.Syntaxbreak;Now let's take a very simple example, where we have a variable named num and we are iterating until num > 5. Suppose we want to exit from the loop when we know that the value inside the num variable has ... Read More

Bitwise operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:26:03

4K+ Views

Bitwise operators are operators that are used to perform bit-level operations on operands. For example, consider two variables x and y where the values stored in them are 20 and 5 respectively.The binary representation of both these numbers will look something like this −x = 10100 y = 00101We make use of all the bitwise operators in Dart to perform on the values that are shown in the above table (bit values).In the below table all the bitwise operators that are present in Dart are mentioned.Consider the table as a reference.OperatorMeaningExampleDescription&Binary AND( x & y )Will produce 00100|Binary OR( x | ... Read More

Async and Await in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:27:02

1K+ Views

Async and Await keywords are used to provide a declarative way to define the asynchronous function and use their results.The async keyword is used when we want to declare a function as asynchronous and the await keyword is used only on asynchronous functions.Syntaxvoid main() async { .. }If the function has a declared return type, then update the type of the Future to the return type.Future main() async { .. }And finally, we make use of await keyword when we want to wait for the asynchronous function to finish.await someAsynchronousFunction()ExampleLet's consider an example where we are declaring the main function ... Read More

Assignment operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:16:05

2K+ Views

We make use of assignment operators whenever we want to assign values to a variable. There are times when we combine assignment operators with arithmetic operators and logical operators to build a shorthand version of both the assignment and arithmetic (or logical) expression. These shorthand versions are also known as compound statements.In the table below, all the assignment operators that are present in dart are mentioned.Consider the table shown below −OperatorDescriptionExpression=Assignment operatora = b+=Add and assign combineda += b is equivalent to a = a + b-=Subtract and assigna –= b is equivalent to a = a - b*=Multiply and ... Read More

Arithmetic operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:18:14

1K+ Views

Arithmetic operators are used to perform different arithmetic operations.These arithmetic operations mainly are −AdditionSubtractionMultiplicationDivisionModulus, etc.Let's consider that we have two int variables named x and y, where x is storing the value 10 and y is storing the value 20.In the below table, you can see all the arithmetic operators, with their symbol, name, what output they yield etc.Consider the table shown below −OperatorNameDescriptionOutput+AdditionAddition of two or more operandsx + y = 30-SubtractionSubtraction of the second operand from the firstx - y = -10*MultiplicationMultiplication of two or more operandsx * y = 200/DivisionReturns quotient after divisionx / y = 0.5%ModulusReturns ... Read More

Advertisements