Comments in Rust Programming

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

877 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

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

Comments in Dart Programming

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

438 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

Break Statement in Dart Programming

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

263 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

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

Abstract Classes in Dart Programming

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

2K+ Views

Abstract classes in Dart are classes that contain one or more abstract methods.Note: Abstract methods are those methods that don't have any implementation.It should also be noted that a class in Dart can be declared abstract using the "abstract" keyword followed by the class declaration. A class that is declared using the abstract keyword may or may include abstract methods.An abstract class is allowed to have both the abstract methods and concrete methods (methods with implementation). Though, on the contrary, a normal class (non-abstract class) cannot have abstract methods.An abstract class is mainly used to provide a base for subclasses to extend and ... Read More

crypto.privateDecrypt Method in Node.js

Mayank Agarwal
Updated on 20-May-2021 13:36:53

2K+ Views

The crypto.privateDecrypt() is used for decrypting the given data content by using a private key passed in the parameter that was previously encrypted using the corresponding public key with crypto.publicEncrypt() method.Syntaxcrypto.privateDecrypt(privateKey, buffer)ParametersThe above parameters are described as below −key – It can contain the below 5 types of data of the following type – Object, String, Buffer or KeyObject.oaepHash – This field contains the hash function to be used for OAEP padding and MGF1. Default value is: 'sha1'.oaepLabel – This field contains the value for OAEP padding. No lable is used if not specified.padding – This is an optional value defined in crypto.constants.buffer – This ... Read More

Writable Object Mode Property in Node.js

Mayank Agarwal
Updated on 20-May-2021 13:33:59

228 Views

The writable.writableObjectMode property is used for getting the objectMode property of the given writable Stream. The property will return 'true' if the object mode is set, else 'false' will be returned.Syntaxwriteable.writableObjectModeExampleCreate a file with name – writableObjectMode.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −node writableObjectMode.jswritableObjectMode.js Live Demo// Program to demonstrate writable.writableObjectMode property // Importing the stream module const stream = require('stream'); // Setting the objectMode to true objectMode: true // Creating a data stream with writable const writable = new stream.Writable({   ... Read More

Writable Length Property in Node.js

Mayank Agarwal
Updated on 20-May-2021 13:33:30

243 Views

The writable.writableLength property is used for displaying the number of bytes or objects which are there in the queue that are ready to be written. This is used for inspecting the data as per the status from highWaterMark.Syntaxwriteable.writableLengthExample 1Create a file with name – writableLength.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −node writableLength.js Live Demo// Program to demonstrate writable.writableLength method const stream = require('stream'); // Creating a data stream with writable const writable = new stream.Writable({    // Writing the data from stream ... Read More

Stream Writable Cork and Uncork Method in Node.js

Mayank Agarwal
Updated on 20-May-2021 13:30:16

702 Views

The writable.cork() method is used for forcing all the written data to be buffered inside a memory. This buffered data will only be removed from the buffer memory after stream.uncork() or stream.end() method have been called.Syntaxcork()writeable.cork()uncork()writeable.uncork()ParametersSince it buffers the written data. Only parameter that's needed will be the writable data.ExampleCreate a file with name – cork.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −node cork.jscork.js Live Demo// Program to demonstrate writable.cork() method const stream = require('stream'); // Creating a data stream with writable const ... Read More

Advertisements