<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Vishnu Damwala</title>
    <description>The latest articles on Forem by Vishnu Damwala (@cooldashing24).</description>
    <link>https://forem.com/cooldashing24</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F268806%2Fe047c5dc-0980-4043-89f6-d2a637e36d38.jpeg</url>
      <title>Forem: Vishnu Damwala</title>
      <link>https://forem.com/cooldashing24</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/cooldashing24"/>
    <language>en</language>
    <item>
      <title>Constructor in JAVA</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Sat, 27 Nov 2021 09:37:17 +0000</pubDate>
      <link>https://forem.com/cooldashing24/constructor-in-java-5hc8</link>
      <guid>https://forem.com/cooldashing24/constructor-in-java-5hc8</guid>
      <description>&lt;p&gt;In this article, we will go through Java constructors, their types with the help of examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Constructor?
&lt;/h2&gt;

&lt;p&gt;Constructor is a special member function in JAVA whose name is the same as the class name. It is used to initialize objects at the time of their creation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Java constructor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DemoExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;DemoExample&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// constructor body&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;DemoExample()&lt;/code&gt; is a constructor. It has the same name as that of the class and does not have any return type, not even &lt;strong&gt;&lt;code&gt;void&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constructor in JAVA
&lt;/h2&gt;

&lt;p&gt;It has no return type, not even &lt;code&gt;void&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It is invoked at the time of object creation or when an instance is created.&lt;/p&gt;




&lt;h2&gt;
  
  
  Types of Constructor
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  No-Arguments Constructor&lt;/li&gt;
&lt;li&gt;  Parameterized Constructor&lt;/li&gt;
&lt;li&gt;  Default Constructor&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  No-Arguments Constructor
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  The &lt;strong&gt;no-argument constructor&lt;/strong&gt; is a constructor that does not accept any parameters/arguments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example 2: Java No-argument constructor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;//No-argument constructor&lt;/span&gt;
    &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;setDetails&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;47&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setDetails&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"-----------------------"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Length: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Width: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Area: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;calcArea&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;calcArea&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ConstructorDemo1&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="n"&gt;r1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;r1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 2 Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;----------------------------
Length: 52.0
Width: 47.0
Area: 2444.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Parameterized Constructor
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  The Java parameterized constructor can also accept one or more parameters/arguments.&lt;/li&gt;
&lt;li&gt;  Such constructors are known as parameterized constructors or constructors with parameters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example 3: Java Parameterized Constructor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;//Parameterized constructor&lt;/span&gt;
    &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;setDetails&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setDetails&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"-----------------------"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Length: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Width: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Area: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;calcArea&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;calcArea&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ConstructorDemo2&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="n"&gt;r1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;r1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 3 Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;----------------------------
Length: 101.0
Width: 70.0
Area: 7070.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Default Constructor
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  The Java compiler will create a no-argument constructor automatically when the user-defined constructor is not explicitly declared. Such constructor is known as the &lt;strong&gt;default constructor&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  Each class has its own default constructor.&lt;/li&gt;
&lt;li&gt;  The &lt;strong&gt;Default constructor&lt;/strong&gt; do not accept arguments.&lt;/li&gt;
&lt;li&gt;  Constructor declared by compiler initializes the object with default values.&lt;/li&gt;
&lt;li&gt;  Once the user defines its own default constructor, the compiler will use it to initialize an object.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example 4: Java Default Constructor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"-----------------------"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Length: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Width: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ConstructorDemo3&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Rectangle&lt;/span&gt; &lt;span class="n"&gt;r1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;r1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 4 Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;----------------------------
Length: 0.0
Width: 0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any uninitialized instance variables will be initialized with default values by the default constructor.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;boolean&lt;/td&gt;
&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;byte&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;short&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;int&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;long&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0L&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;char&lt;/td&gt;
&lt;td&gt;&lt;code&gt;\u0000&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.0f&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.0d&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;object&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Reference null&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/java-constructor/"&gt;Constructor in JAVA&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others posts on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

</description>
      <category>java</category>
      <category>constructor</category>
    </item>
    <item>
      <title>Dart - Comments</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Thu, 22 Jul 2021 15:03:18 +0000</pubDate>
      <link>https://forem.com/cooldashing24/dart-comments-3bpj</link>
      <guid>https://forem.com/cooldashing24/dart-comments-3bpj</guid>
      <description>&lt;p&gt;The comments are notes that developers can add in source code and are ignored by compilers. It's an &lt;strong&gt;art&lt;/strong&gt; of describing what your code does and may be why. These comments are not evaluated.&lt;/p&gt;

&lt;p&gt;It increases the code readability for other developers as well as self that allows to provide information of what tricky things are done within the code for better understanding and maintenance.&lt;/p&gt;

&lt;p&gt;In this article, we will look into different types of comments supported by Dart.&lt;/p&gt;

&lt;p&gt;The comments in Dart can be done in following different ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single-line comments &lt;code&gt;//&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Multi-line comments &lt;code&gt;/* ... */&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Single-line Doc comments &lt;code&gt;///&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Multi-line Doc comments &lt;code&gt;/** ... */&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Single-line comments in Dart
&lt;/h2&gt;

&lt;p&gt;Single line comment can be done by &lt;strong&gt;&lt;code&gt;//&lt;/code&gt;&lt;/strong&gt; i.e &lt;strong&gt;double slash&lt;/strong&gt; or &lt;strong&gt;double forward slash&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// this is a single-line comment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Multi-line comments in Dart
&lt;/h2&gt;

&lt;p&gt;Multi-line comment also known as &lt;strong&gt;block comment&lt;/strong&gt;. It can be done by &lt;strong&gt;&lt;code&gt;/* ... */&lt;/code&gt;&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
  this is a multi-line comment
  we can also wrap code that is quite useful during debugging or development
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dart &lt;a href="https://dart.dev/guides/language/effective-dart/documentation#dont-use-block-comments-for-documentation"&gt;guide&lt;/a&gt; suggests us to single-line comment &lt;code&gt;//&lt;/code&gt;. The block comment &lt;code&gt;(/* ... */)&lt;/code&gt; should only be used &lt;strong&gt;temporarily&lt;/strong&gt; to comment out a section of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single-line Doc comments in Dart
&lt;/h2&gt;

&lt;p&gt;Doc comments parsed by &lt;a href="https://github.com/dart-lang/dartdoc"&gt;dartdoc&lt;/a&gt; generates &lt;a href="https://api.dart.dev/stable"&gt;beautiful doc pages&lt;/a&gt; from them. A comment is any comment that appears before a declaration is called as Doc comment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Doc comments also supports Markdown formatting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Single line Doc comment can be done by &lt;strong&gt;&lt;code&gt;///&lt;/code&gt;&lt;/strong&gt; i.e &lt;strong&gt;triple slash&lt;/strong&gt; or &lt;strong&gt;triple forward slash&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can find usage of it in &lt;a href="https://github.com/dart-lang/sdk/blob/master/sdk/lib/io/io.dart"&gt;dart:io&lt;/a&gt; library available on GitHub&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;/// this is a single-line comment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Multi-line Doc comments in Dart
&lt;/h2&gt;

&lt;p&gt;Multi line Doc comment can be done by &lt;strong&gt;`/&lt;/strong&gt; ... */`**. Below is an example of multi-line Doc comment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
  * ** Important:** Browser-based apps can't use this library.
  * Only the following can import and use the dart:io library:
  *   - Servers
  *   - Command-line scripts
  *   - Flutter mobile apps
  *   - Flutter desktop apps
  */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/dart-comments/"&gt;Dart - Comments&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>programming</category>
    </item>
    <item>
      <title>Install XAMPP on Ubuntu</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Fri, 04 Jun 2021 05:21:50 +0000</pubDate>
      <link>https://forem.com/cooldashing24/install-xampp-on-ubuntu-1pm0</link>
      <guid>https://forem.com/cooldashing24/install-xampp-on-ubuntu-1pm0</guid>
      <description>&lt;p&gt;A &lt;a href="https://apachefriends.org/" rel="noopener noreferrer"&gt;XAMPP&lt;/a&gt; is one of the most popular cross-platform PHP development environment. It is an open source package that can be easily install and to use.&lt;/p&gt;

&lt;p&gt;XAMPP stands for cross-platform (&lt;strong&gt;X&lt;/strong&gt;), Apache (&lt;strong&gt;A&lt;/strong&gt;), MariaDB (&lt;strong&gt;M&lt;/strong&gt;), PHP (&lt;strong&gt;P&lt;/strong&gt;), and Perl (&lt;strong&gt;P&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;XAMPP has been used widely by developers and has been around here with huge support of community since more than 10 years. It's currently available on Windows, Linux &amp;amp; Mac platforms while writing this article.&lt;/p&gt;

&lt;p&gt;To download the Linux installer head over to the &lt;a href="https://www.apachefriends.org/download.html" rel="noopener noreferrer"&gt;Download&lt;/a&gt; page. Here you will find latest release as well as previous versions.&lt;/p&gt;

&lt;p&gt;While writing this article, the latest release version is 8.0.6. In this article, we will see how to install this open-source application in Ubuntu or Ubuntu-based distributions. Follow the same steps to install into other Ubuntu-based Distros.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install XAMPP on Ubuntu or Ubuntu-based Distros
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Download the XAMPP installer
&lt;/h3&gt;

&lt;p&gt;Head over to &lt;a href="https://www.apachefriends.org/index.html" rel="noopener noreferrer"&gt;XAMPP Home&lt;/a&gt; page and select &lt;strong&gt;XAMPP for Linux&lt;/strong&gt;, that contains direct link that can be used for the latest version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F778lxi07vtarck9svdqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F778lxi07vtarck9svdqj.png" alt="Source: apachefriends.org"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once it's downloaded, open your terminal (&lt;code&gt;Ctrl + Alt + T&lt;/code&gt;), head over to your directory where your installer has been saved and run the below commands with &lt;code&gt;sudo&lt;/code&gt; privileges to change the permission.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;755 xampp-linux-&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-installer&lt;/span&gt;.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will give permission to the installer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: Replace &lt;code&gt;xampp-linux-*-installer.run&lt;/code&gt; with actual file name.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the XAMPP installer
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; ./xampp-linux-&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-installer&lt;/span&gt;.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will start the installer wizard. Proceed with installation, make changes if you need. By default it will be installed in &lt;code&gt;/opt/lampp/&lt;/code&gt; directory, you can customize the installation directory too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install supporting package
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;net-tools &lt;span class="nt"&gt;-fy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will install &lt;code&gt;netstat&lt;/code&gt; that is a part of the &lt;code&gt;net-tools&lt;/code&gt; package.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start, Stop &amp;amp; Restart Server
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Start, Stop &amp;amp; Restart Server via command line aka CLI
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Start the server with below command
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/lampp/lampp start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Stop the server with below command
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/lampp/lampp stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Restart the server with below command
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/lampp/lampp restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Start, Stop &amp;amp; Restart Server via Graphical User Interface aka GUI
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Execute the below command to launch graphical manager
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/lampp/manager-linux-x64.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create alias or shortcuts for commands for Bash Shell
&lt;/h3&gt;

&lt;p&gt;Below command will create an alias for command for Bash shell, so you only need to use &lt;code&gt;lamppStart&lt;/code&gt; to launch the graphical manager. You might need to reopen the terminal to use this newly added alias.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "alias lamppStart='cd /opt/lampp/ &amp;amp;&amp;amp; sudo ./manager-linux-x64.run'" &amp;gt;&amp;gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating a launcher icon
&lt;/h2&gt;

&lt;p&gt;With the below code, you can create it a launcher icon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.local/share/applications/postman.desktop &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOL&lt;/span&gt;&lt;span class="sh"&gt;
[Desktop Entry]
Version=1.2
Encoding=UTF-8
Name=XAMPP
Exec=sh -c "pkexec env DISPLAY=&lt;/span&gt;&lt;span class="nv"&gt;$DISPLAY&lt;/span&gt;&lt;span class="sh"&gt; XAUTHORITY=&lt;/span&gt;&lt;span class="nv"&gt;$XAUTHORITY&lt;/span&gt;&lt;span class="sh"&gt; sudo /opt/lampp/manager-linux-x64.run"
Icon=/opt/lampp/htdocs/favicon.ico
Terminal=false
Type=Application
Categories=Network;WebBrowser;Development;
MimeType=text/html
&lt;/span&gt;&lt;span class="no"&gt;EOL
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Uninstall XAMPP
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;To uninstall XAMPP, open the terminal and navigate to the &lt;code&gt;opt/lampp&lt;/code&gt; directory with the below command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /opt/lampp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Execute the below command to uninstall XAMPP.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo&lt;/span&gt; ./uninstall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The prompt dialogue box will open asking for your confirmation to uninstall XAMPP and all of its modules.&lt;/li&gt;
&lt;li&gt;Finally, remove the lampp installation directory with below command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo rm&lt;/span&gt; –r /opt/lamp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;After reading this article, you will be able install XAMPP on Ubuntu or Linux devices.&lt;/p&gt;

&lt;p&gt;XAMPP allows you to set up a free development environment on your system. It is a set of tools that allows you to get your site up and running much easily &amp;amp; quickly. An alternative to installing and configuring individual components.&lt;/p&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/install-xampp-on-ubuntu/" rel="noopener noreferrer"&gt;Install XAMPP on Ubuntu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in" rel="noopener noreferrer"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

</description>
      <category>xampp</category>
      <category>php</category>
      <category>install</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Python - Arithmetic Operators</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Tue, 25 May 2021 17:22:30 +0000</pubDate>
      <link>https://forem.com/cooldashing24/python-arithmetic-operators-39ob</link>
      <guid>https://forem.com/cooldashing24/python-arithmetic-operators-39ob</guid>
      <description>&lt;p&gt;Python supports different arithmetic operators that can be used to performs mathematical calculations on the values and variables.&lt;/p&gt;

&lt;p&gt;The basic arithmetic operations include addition, subtraction, multiplication, division.&lt;/p&gt;

&lt;p&gt;Arithmetic operations are performed according to the order or precedence of operators.&lt;/p&gt;

&lt;h1&gt;
  
  
  The general structure of every expression
&lt;/h1&gt;

&lt;p&gt;Every expression will follow this general structure&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operand&lt;/strong&gt; Operator &lt;strong&gt;Operand&lt;/strong&gt; [Operator &lt;strong&gt;Operand&lt;/strong&gt;] ...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operand represents data.&lt;/li&gt;
&lt;li&gt;An operator is a symbol used to operate such as mathematical, logical or relational producing a final result.&lt;/li&gt;
&lt;li&gt;For example, &lt;code&gt;x + y&lt;/code&gt; where &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are &lt;strong&gt;operands&lt;/strong&gt; and &lt;code&gt;+&lt;/code&gt; is an &lt;strong&gt;operator&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;For example, &lt;code&gt;a = 7&lt;/code&gt; where, &lt;code&gt;=&lt;/code&gt; is an &lt;strong&gt;operator&lt;/strong&gt; and &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt; are &lt;strong&gt;operands&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, you will find &lt;strong&gt;Arithmetic&lt;/strong&gt; operators provided by Dart.&lt;/p&gt;

&lt;h1&gt;
  
  
  Arithmetic operators
&lt;/h1&gt;

&lt;p&gt;Basic mathematical calculations are performed on &lt;strong&gt;numeric values&lt;/strong&gt; with the use of arithmetic operators.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Addition&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x + y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Subtraction&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x - y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-expr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Unary minus&lt;/strong&gt;, aka &lt;strong&gt;negation&lt;/strong&gt; (reverse the sign of the expression)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;-x&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Multiplication&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x * y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Division (aka True division)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x / y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;//&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Divide, returning an integer result (aka Floor division)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x // y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Get the remainder of an integer division (modulo)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x % y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exponential&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x ** y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;All of these listed operators are binary operators.&lt;/li&gt;
&lt;li&gt;All these operators also follow the general structure of &lt;strong&gt;&lt;code&gt;Operand&lt;/code&gt;&lt;/strong&gt; &lt;code&gt;Operator&lt;/code&gt; &lt;strong&gt;&lt;code&gt;Operand&lt;/code&gt;&lt;/strong&gt;, meaning that an operator is always surrounded by two operands.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;**&lt;/code&gt; operator is evaluated first; then &lt;code&gt;*&lt;/code&gt; , &lt;code&gt;/&lt;/code&gt; , &lt;code&gt;//&lt;/code&gt; , and &lt;code&gt;%&lt;/code&gt; operators are evaluated next (from left to right); and the &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt; operators are evaluated last (also from left to right).&lt;/li&gt;
&lt;li&gt;To override the usual precedence, &lt;strong&gt;parentheses&lt;/strong&gt; &lt;code&gt;()&lt;/code&gt; comes handy.&lt;/li&gt;
&lt;li&gt;For example, an expression &lt;code&gt;x + y&lt;/code&gt; is a binary operation, where &lt;strong&gt;x&lt;/strong&gt; and &lt;strong&gt;y&lt;/strong&gt; are the two operands and &lt;strong&gt;+&lt;/strong&gt; is an operator.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Addition (&lt;code&gt;+&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The plus (&lt;code&gt;+&lt;/code&gt;) is used for addition in the Python PL.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [1]: 3 + 4
Out[1]: 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Subtraction (&lt;code&gt;-&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The minus or hyphen (&lt;code&gt;-&lt;/code&gt;) is used for subtraction in the Python PL.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [2]: 13 - 3
Out[2]: 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Unary minus (&lt;code&gt;-&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The minus or hyphen (&lt;code&gt;-&lt;/code&gt;) is used as a unary minus operator in the Python PL.&lt;/li&gt;
&lt;li&gt;The unary minus is used to show a negative number.&lt;/li&gt;
&lt;li&gt;The unary minus &lt;code&gt;-&lt;/code&gt; operator negates the value of an operand.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [3]: -3
Out[3]: -3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Multiplication (&lt;code&gt;*&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The asterisk (&lt;code&gt;*&lt;/code&gt;) is used as a multiplication operator in the Python PL.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [4]: 7 * 4
Out[4]: 28
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Division (&lt;code&gt;/&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The forward slash (&lt;code&gt;/&lt;/code&gt;) is used as a division operator in the Python PL. Also known as &lt;strong&gt;True division&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [5]: 24 / 4
Out[5]: 6.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Floor Division (&lt;code&gt;//&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The double forward slash (&lt;code&gt;//&lt;/code&gt;) is used as a floor division operator in the Python PL. Also known as &lt;strong&gt;integer division&lt;/strong&gt; operator.&lt;/li&gt;
&lt;li&gt;This operator yields the highest integer, ignoring the decimal part. Yielded integer is not greater than the actual divided result.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [6]: 11 / 4
Out[6]: 2.75

In [7]: 11 // 4
Out[7]: 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;On dividing &lt;strong&gt;11&lt;/strong&gt; by &lt;strong&gt;4&lt;/strong&gt; with &lt;code&gt;/&lt;/code&gt; operator, the output obtained is &lt;strong&gt;2.75&lt;/strong&gt;. But by using &lt;code&gt;//&lt;/code&gt; operator output obtained with the same values is &lt;code&gt;2&lt;/code&gt; i.e not greater than the actual answer &lt;code&gt;2.75&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Modulus (&lt;code&gt;%&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The percentage (&lt;code&gt;%&lt;/code&gt;) is used as &lt;strong&gt;mod&lt;/strong&gt; or &lt;strong&gt;remainder operator&lt;/strong&gt; in the Python PL. Also known as &lt;strong&gt;MOD or Remainder&lt;/strong&gt; operator.&lt;/li&gt;
&lt;li&gt;It also works with floating-point values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [10]: 24 % 7
Out[10]: 3

In [11]: 24 % 3.5
Out[11]: 3.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exponential (&lt;code&gt;**&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The double asterisk &lt;code&gt;**&lt;/code&gt; operator is used to perform the exponential operation in Python PL.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In [10]: 2 ** 5
Out[10]: 32

In [11]: 1.5 ** 5
Out[11]: 7.59375
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: Python exponential operator &lt;code&gt;**&lt;/code&gt; works in the same way as the &lt;code&gt;pow(a, b)&lt;/code&gt; function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/python-arithmetic-operators/"&gt;Python - Arithmetic Operators&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>fundamentals</category>
    </item>
    <item>
      <title>Get Last Array Element in PHP and Laravel</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Sun, 11 Apr 2021 08:06:43 +0000</pubDate>
      <link>https://forem.com/cooldashing24/get-last-array-element-in-php-and-laravel-2kpo</link>
      <guid>https://forem.com/cooldashing24/get-last-array-element-in-php-and-laravel-2kpo</guid>
      <description>&lt;p&gt;Laravel provides the &lt;code&gt;last()&lt;/code&gt; function as a global helper and also as a function defined in &lt;code&gt;Illuminate\Support\Arr&lt;/code&gt; that can be used to get the last element in an array.&lt;/p&gt;

&lt;p&gt;This article, guide through the different ways of retrieving the last array element in &lt;code&gt;PHP&lt;/code&gt; also in &lt;code&gt;Laravel&lt;/code&gt;. So you can decide which suits you best.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to get the last item in the array?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Retrieve the last element in PHP
&lt;/h2&gt;

&lt;p&gt;In PHP, to get the last element from an array, first, you need to count the total array elements&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$languages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'JAVA'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'PHP'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'C++'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'C#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Python'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$totalElements&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$languages&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$languages&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$totalElements&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Above code will output &lt;code&gt;Python&lt;/code&gt; i.e the last element in a provided array.&lt;/li&gt;
&lt;li&gt;It is a more readable approach, can also be rewritten in a single line as shown, which sometimes looks complex for beginners.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$languages&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$languages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Retrieve the last element in Laravel
&lt;/h2&gt;

&lt;p&gt;In Laravel, you can get the last array element in two ways.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using global &lt;code&gt;last()&lt;/code&gt; helper.&lt;/li&gt;
&lt;li&gt;Using the static method of &lt;code&gt;Arr&lt;/code&gt; class named &lt;code&gt;last()&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Using global &lt;code&gt;last()&lt;/code&gt; helper
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;last()&lt;/code&gt; helper function returns the last element in the given array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$carBrands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'Maserati'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Tesla'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Tata'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Aston Martin'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Audi'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Alfa Romeo'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nf"&gt;last&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$carBrands&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Above code will output &lt;code&gt;Alfa Romeo&lt;/code&gt; i.e the last element in a provided array named &lt;code&gt;$carBrands&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;last()&lt;/code&gt; function in Arr class
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;last()&lt;/code&gt; helper function returns the last element in the given array.&lt;/li&gt;
&lt;li&gt;Before using it, remember to import using the &lt;code&gt;use Illuminate\Support\Arr;&lt;/code&gt; statement.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Arr&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;last&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$default&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The first parameter is a source &lt;strong&gt;array&lt;/strong&gt;, from which the last element is to be found. It's a required parameter.&lt;/li&gt;
&lt;li&gt;The second parameter is a &lt;strong&gt;callback function&lt;/strong&gt;, that can be either helpful to filter &amp;amp; retrieve the last element based on conditions. It's an optional parameter.&lt;/li&gt;
&lt;li&gt;The third parameter is a &lt;strong&gt;default value&lt;/strong&gt; &amp;amp; it will be returned if none of the array elements passes the truth test.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'Orange 🍊'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Apple 🍎'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Grapes 🍇'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Kiwi 🥝'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'Mango 🥭'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nc"&gt;Arr&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;last&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Above code will output &lt;code&gt;Mango 🥭&lt;/code&gt; i.e the last element in a provided array named &lt;code&gt;$fruits&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/get-last-array-element-in-php-and-laravel/"&gt;Get Last Array Element in PHP and Laravel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>array</category>
      <category>php</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Install Telegram on Ubuntu 20.04 or Ubuntu-based distributions</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Thu, 25 Feb 2021 08:37:46 +0000</pubDate>
      <link>https://forem.com/cooldashing24/install-telegram-on-ubuntu-20-04-or-ubuntu-based-distributions-4p60</link>
      <guid>https://forem.com/cooldashing24/install-telegram-on-ubuntu-20-04-or-ubuntu-based-distributions-4p60</guid>
      <description>&lt;p&gt;&lt;a href="https://telegram.org/"&gt;Telegram&lt;/a&gt; is a free instant messaging tool with a focus on simplicity, security, speed, and synced across all your devices.&lt;/p&gt;

&lt;p&gt;Telegram can be used on all your devices simultaneously - with any number of your phones, tablets, or computers syncing your messages or files seamlessly.&lt;/p&gt;

&lt;p&gt;Telegram allows you to share messages, photos, videos, and files of any type (&lt;code&gt;doc&lt;/code&gt;, &lt;code&gt;zip&lt;/code&gt;, &lt;code&gt;mp3&lt;/code&gt;, etc) in a secured and safe manner.&lt;/p&gt;

&lt;p&gt;Everything on Telegram is encrypted using a combination of &lt;strong&gt;256-bit symmetric AES&lt;/strong&gt; encryption, &lt;strong&gt;2048-bit RSA&lt;/strong&gt; encryption, and &lt;strong&gt;Diffie–Hellman&lt;/strong&gt; secure key exchange including chats, groups, media, etc.&lt;/p&gt;

&lt;p&gt;I've been using it for more than 5 years and saw it evolving. The telegram is a cross-platform, open-source, and powerful messaging app developed by &lt;a href="https://en.wikipedia.org/wiki/Pavel_Durov"&gt;Pavel Durov&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/Nikolai_Durov"&gt;Nikolai Durov&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Axel_Neff"&gt;Axel Neff&lt;br&gt;
&lt;/a&gt;. The repository for source code is available on &lt;a href="https://github.com/tdlib/td"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Some of the supported available features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Telegram is so simple to use it.&lt;/li&gt;
&lt;li&gt;The messages are self-destructing and encrypted heavily.&lt;/li&gt;
&lt;li&gt;Share unlimited media in terms of number &amp;amp; size.&lt;/li&gt;
&lt;li&gt;Completely customize your messenger.&lt;/li&gt;
&lt;li&gt;Telegram has an open &lt;a href="https://core.telegram.org/api"&gt;API&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Video &amp;amp; audio calling&lt;/li&gt;
&lt;li&gt;Free and &lt;a href="https://telegram.org/apps#source-code"&gt;open-source&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Drag and drop media&lt;/li&gt;
&lt;li&gt;and many more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, we will see how to install this open-source messaging app in Ubuntu or Ubuntu-based distributions. Follow the same steps to install into other Ubuntu-based distributions:&lt;/p&gt;
&lt;h3&gt;
  
  
  Install Telegram
&lt;/h3&gt;

&lt;p&gt;Telegram can be installed via the &lt;a href="https://snapcraft.io/"&gt;Snapcraft&lt;/a&gt; store as a &lt;code&gt;snap&lt;/code&gt; package or with &lt;code&gt;apt&lt;/code&gt; or via official tarball.&lt;/p&gt;
&lt;h3&gt;
  
  
  Method 1: Installing Telegram as a Snap Package
&lt;/h3&gt;

&lt;p&gt;Canonical manages and distributes the Telegram snap package, the one behind Ubuntu.&lt;/p&gt;

&lt;p&gt;Snap packages are secure &amp;amp; easy to upgrade. As Snaps are self-contained software packages. It includes all dependencies needed to run an application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r53j-Rsx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9t4u3s94n1wsgdmm1q1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r53j-Rsx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9t4u3s94n1wsgdmm1q1.png" alt="SnapCraft"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Snap packages can be installed either from the Ubuntu Software application or via command-line.&lt;/p&gt;
&lt;h4&gt;
  
  
  Via Terminal
&lt;/h4&gt;

&lt;p&gt;Open your terminal (&lt;code&gt;Ctrl+Alt+T&lt;/code&gt;) and run the below command with sudo privileges&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;snap &lt;span class="nb"&gt;install &lt;/span&gt;telegram-desktop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will install the latest Telegram and other dependencies too. The snap package will automatically update(in the background) whenever a new version of Telegram is released.&lt;/p&gt;

&lt;p&gt;We can also install from &lt;strong&gt;&lt;a href="https://dev.tosnap://telegram-desktop"&gt;Ubuntu Software&lt;/a&gt;&lt;/strong&gt;, search for &lt;strong&gt;Telegram&lt;/strong&gt; and install the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Method 2: Official Telegram Download
&lt;/h3&gt;

&lt;p&gt;Telegram also provides you an official desktop application that can be downloaded from their official Telegram website. Or head over to &lt;a href="https://desktop.telegram.org/"&gt;Desktop App&lt;/a&gt; section which lets you download a Telegram desktop app installer that is supported on a variety of operating systems, including MAC, Android, Windows, Ubuntu, Linux Mint, and many more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--St7RXirj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6bhyql26iwzi8c27qif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--St7RXirj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6bhyql26iwzi8c27qif.png" alt="Telegram On Laptop"&gt;&lt;/a&gt;&lt;br&gt;
Source: telegram.org&lt;/p&gt;

&lt;p&gt;Click an official link below to download the tarball package for Linux distribution (including Ubuntu) which contains a standalone Telegram runtime and updater:&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;a href="https://telegram.org/dl/desktop/linux"&gt;Download Telegram for Linux (64-bit .tar.xz)&lt;/a&gt;
&lt;/h4&gt;
&lt;h4&gt;
  
  
  &lt;a href="https://telegram.org/dl/desktop/linux32"&gt;Download Telegram for Linux (32-bit .tar.xz)&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;To &lt;strong&gt;run&lt;/strong&gt; Telegram using archive package is easy. Extract the &lt;strong&gt;&lt;code&gt;tar.xz&lt;/code&gt;&lt;/strong&gt; archive, enter into the extracted folder, then &lt;strong&gt;double-click&lt;/strong&gt; on the &lt;strong&gt;telegram binary&lt;/strong&gt; inside to launch the app.&lt;/p&gt;

&lt;p&gt;You can then follow the setup instructions wizard that appears on your screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: This method does not "install" the app on your system. But it will add a &lt;code&gt;Telegram&lt;/code&gt; app shortcut to your system app launcher menu.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Do not delete the binary file. The shortcut is linked to this binary file
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Method 3: Installing from official PPA using terminal
&lt;/h3&gt;

&lt;p&gt;A PPA for Telegram is available for download. First, we need to add PPA to our system.&lt;/p&gt;

&lt;p&gt;Open your terminal (&lt;code&gt;Ctrl+Alt+T&lt;/code&gt;) and run the below commands with &lt;code&gt;sudo&lt;/code&gt; privileges.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;add-apt-repository ppa:atareao/telegram
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; telegram
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Single line command
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;add-apt-repository ppa:atareao/telegram &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; telegram
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will install the Telegram with other dependencies and fixes broken packages if any. It can be updated through the &lt;strong&gt;command-line&lt;/strong&gt; or your Software Update tool&lt;/p&gt;

&lt;h3&gt;
  
  
  Run application
&lt;/h3&gt;

&lt;p&gt;Once the installation is done, we can now run &lt;strong&gt;&lt;code&gt;telegram&lt;/code&gt;&lt;/strong&gt; from &lt;strong&gt;application launcher&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in/"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you find this helpful!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>telegram</category>
      <category>install</category>
      <category>howto</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Configure user name &amp; email for Git profile using terminal</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Thu, 11 Feb 2021 03:46:46 +0000</pubDate>
      <link>https://forem.com/cooldashing24/configure-user-name-email-for-git-profile-using-terminal-3ak9</link>
      <guid>https://forem.com/cooldashing24/configure-user-name-email-for-git-profile-using-terminal-3ak9</guid>
      <description>&lt;p&gt;Git allows you to configure a global and per-project Git profile consisting of name and email address.&lt;/p&gt;

&lt;p&gt;Git commands come handy when you want to set or change your git identity. &lt;strong&gt;&lt;code&gt;Changes only affect future commits&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set or update user name for local Git profile using terminal
&lt;/h3&gt;

&lt;p&gt;The first thing you should do when you install Git is to set your name and email address.&lt;/p&gt;

&lt;p&gt;This is important because every Git commit uses this information. By default this information will be used if none other specified.&lt;/p&gt;

&lt;p&gt;And it's immutably baked into the commits you create.&lt;/p&gt;




&lt;h4&gt;
  
  
  Commands to configure Git user profile
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git config --global user.name "your-name"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git config --global user.email "your-email"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;--global&lt;/code&gt; option will set your global commit name &amp;amp; email address.&lt;/p&gt;

&lt;p&gt;Once done, verify that the information is configured by executing below command in terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h5&gt;
  
  
  Example
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"Jane Doe"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"jane.doe@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in/"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>git</category>
      <category>terminal</category>
      <category>command</category>
    </item>
    <item>
      <title>Headings in Markdown</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Tue, 09 Feb 2021 17:00:33 +0000</pubDate>
      <link>https://forem.com/cooldashing24/headings-in-markdown-n9c</link>
      <guid>https://forem.com/cooldashing24/headings-in-markdown-n9c</guid>
      <description>&lt;p&gt;Headings help to organize your content into an easy to read format. Heading shows the importance of your content specifying headings on a webpage. HTML has different heading tags to tell a web browser how to render content.&lt;/p&gt;

&lt;p&gt;Markdown also has different levels of headings to structure your documents. Start lines with a &lt;code&gt;#&lt;/code&gt; to create headings followed by word or phrase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Always keep an empty single space between &lt;code&gt;#&lt;/code&gt; and your content(word or phrase)
&lt;/h3&gt;

&lt;h1&gt;
  
  
  Level 1 Heading with Markdown
&lt;/h1&gt;

&lt;p&gt;Above is an example for level 1 heading written with &lt;code&gt;# Level 1 Heading&lt;/code&gt; which will be rendered by the browser as &lt;code&gt;&amp;lt;h1&amp;gt;Level 1 Heading&amp;lt;/h1&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Level 1 Heading&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Level 1 Heading&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multiple &lt;code&gt;##&lt;/code&gt; in a row denotes smaller heading sizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 2 Heading with Markdown
&lt;/h2&gt;

&lt;p&gt;Above is an example for level 2 heading written with &lt;code&gt;## Level 2 Heading&lt;/code&gt; which will be rendered by the browser as &lt;code&gt;&amp;lt;h2&amp;gt;Level 2 Heading&amp;lt;/h2&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Level 2 Heading&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Level 2 Heading&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In addition to heading helps improving accessibility for people who can’t easily read screens and also improves general structure and readability.&lt;/p&gt;

&lt;h1&gt;
  
  
  Heading for visually impaired readers
&lt;/h1&gt;

&lt;p&gt;Visually impaired readers use a screen reader to read the text on a screen aloud for them. Headings rendered as HTML heading tags. So by reading or listening to the headings in content, visually impaired readers can get the gist of an article and decide if they’d like to continue reading it.&lt;/p&gt;

&lt;p&gt;Screen readers also allow you to navigate through articles by traversing to the headings. So when your content has good descriptive headings, the readability and navigation for visually impaired readers are improved.&lt;/p&gt;

&lt;h2&gt;
  
  
  This is a level 2 heading improving SEO
&lt;/h2&gt;

&lt;p&gt;The heading also improves SEO for your content as the search engine examines &amp;amp; indexes search results based on keywords usage in headings.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Markdown&lt;/th&gt;
&lt;th&gt;HTML&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;# Heading level 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Heading level 1&amp;lt;/h1&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;## Heading level 2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Heading level 2&amp;lt;/h2&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;### Heading level 3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h3&amp;gt;Heading level 3&amp;lt;/h3&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;#### Heading level 4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h4&amp;gt;Heading level 4&amp;lt;/h4&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;##### Heading level 5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h5&amp;gt;Heading level 5&amp;lt;/h5&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;###### Heading level 6&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;h6&amp;gt;Heading level 6&amp;lt;/h6&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can use &lt;strong&gt;one&lt;/strong&gt; &lt;code&gt;#&lt;/code&gt; all the way up to &lt;code&gt;######&lt;/code&gt; &lt;strong&gt;six&lt;/strong&gt; for different heading levels.&lt;/p&gt;

&lt;p&gt;Six different levels of heading styles supported by Markdown, improving accessibility &amp;amp; SEO.&lt;/p&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/headings-in-markdown/"&gt;Headings in Markdown&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>markdown</category>
      <category>html</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to find the length of a string using strlen in C</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Tue, 02 Feb 2021 16:54:34 +0000</pubDate>
      <link>https://forem.com/cooldashing24/how-to-find-the-length-of-a-string-using-strlen-in-c-2od3</link>
      <guid>https://forem.com/cooldashing24/how-to-find-the-length-of-a-string-using-strlen-in-c-2od3</guid>
      <description>&lt;p&gt;A tutorial for finding the length of a string using &lt;strong&gt;strlen&lt;/strong&gt; in C - language&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;strlen()&lt;/code&gt;&lt;/strong&gt; function counts the number of characters in a given string and returns the long unsigned integer value.&lt;/li&gt;
&lt;li&gt;It is defined in &lt;strong&gt;C&lt;/strong&gt; standard library, within &lt;strong&gt;&lt;code&gt;&amp;lt;string.h&amp;gt;&lt;/code&gt;&lt;/strong&gt; header file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;saying&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Better late than never"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;saying&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;It stops counting when the null character is encounter. Because in C, null character is considered as the end of the string.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Working example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;planet&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Earth"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt; Using strlen for planet without null character: %zu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;planet&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt; Using sizeof for planet with null character: %zu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;planet&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;Using&lt;/span&gt; &lt;span class="n"&gt;strlen&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;planet&lt;/span&gt; &lt;span class="n"&gt;without&lt;/span&gt; &lt;span class="n"&gt;null&lt;/span&gt; &lt;span class="n"&gt;character&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;Using&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;planet&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="n"&gt;null&lt;/span&gt; &lt;span class="n"&gt;character&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; that the &lt;code&gt;strlen()&lt;/code&gt; function doesn't count for the null character &lt;strong&gt;&lt;code&gt;\0&lt;/code&gt;&lt;/strong&gt; whereas &lt;code&gt;sizeof()&lt;/code&gt; function does.&lt;/p&gt;

&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/find-the-length-of-a-string-using-strlen-in-c/"&gt;Find the length of a string using strlen() in C&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>c</category>
      <category>programming</category>
      <category>function</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Laravel's Eloquent whereTime() filtering method</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Fri, 29 Jan 2021 07:16:25 +0000</pubDate>
      <link>https://forem.com/cooldashing24/laravel-s-eloquent-wheretime-filtering-method-20a4</link>
      <guid>https://forem.com/cooldashing24/laravel-s-eloquent-wheretime-filtering-method-20a4</guid>
      <description>&lt;p&gt;Laravel provides many additional methods other than &lt;strong&gt;standard methods&lt;/strong&gt;. You might be familiar with &lt;code&gt;where()&lt;/code&gt;, &lt;code&gt;orWhere()&lt;/code&gt;, &lt;code&gt;whereJsonContains()&lt;/code&gt; or &lt;code&gt;whereJsonLength()&lt;/code&gt;. And these additional methods are worth checking.&lt;/p&gt;

&lt;p&gt;In this article, we will see &lt;code&gt;whereTime()&lt;/code&gt;, one of the supplementary methods that comes in handy when you want to compare the table's field value with a specific time.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;whereTime()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;whereTime()&lt;/code&gt; method helps to get records matching the specific time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sytnax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;whereTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'fieldName'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'operator'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'time'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The first parameter is &lt;code&gt;fieldName&lt;/code&gt; with which a comparison is to be done.&lt;/li&gt;
&lt;li&gt;The second parameter is an &lt;code&gt;operator&lt;/code&gt; for comparison, such as &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt; or &lt;code&gt;&amp;lt;=&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The third parameter is a &lt;code&gt;time&lt;/code&gt; for comparison in &lt;code&gt;HH:MM:SS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;whereTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'login_at'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'11:12:31'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/laravel-additional-eloquent-where-time-clause/"&gt;Laravel's &lt;code&gt;whereTime&lt;/code&gt; Model Method&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>eloquent</category>
      <category>php</category>
      <category>framework</category>
    </item>
    <item>
      <title>Convert array to an object in JavaScript</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Thu, 21 Jan 2021 17:01:57 +0000</pubDate>
      <link>https://forem.com/cooldashing24/convert-array-to-an-object-in-javascript-2a5</link>
      <guid>https://forem.com/cooldashing24/convert-array-to-an-object-in-javascript-2a5</guid>
      <description>&lt;p&gt;During development we often came across a need of conversion an array to an object.&lt;/p&gt;

&lt;p&gt;In this article, lets see how to convert, JavaScript array to an object quickly using widely popular and accepted &lt;strong&gt;spread operator (&lt;code&gt;...&lt;/code&gt;)&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;grapes&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mangoe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;fruitsObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruitsObject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output for &lt;code&gt;console.table&lt;/code&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;(index)&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;"apple"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;"grapes"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;"mango"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;"orange"&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

&lt;p&gt;With ❤️ from 🇮🇳&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>array</category>
      <category>object</category>
      <category>script</category>
    </item>
    <item>
      <title>Dart - Relational Operators</title>
      <dc:creator>Vishnu Damwala</dc:creator>
      <pubDate>Thu, 21 Jan 2021 05:48:39 +0000</pubDate>
      <link>https://forem.com/cooldashing24/dart-relational-operators-3ok9</link>
      <guid>https://forem.com/cooldashing24/dart-relational-operators-3ok9</guid>
      <description>&lt;p&gt;Dart provides operators that can be used to check the relationship between values or values within variables also known as &lt;strong&gt;operands&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;All relational operators, &lt;strong&gt;less than(&lt;code&gt;&amp;lt;&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;less than or equal to(&lt;code&gt;&amp;lt;=&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;greater than(&lt;code&gt;&amp;gt;&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;greater than and equal to(&lt;code&gt;&amp;gt;=&lt;/code&gt;)&lt;/strong&gt; gives resultant value in &lt;strong&gt;boolean&lt;/strong&gt; i.e either &lt;strong&gt;&lt;code&gt;true&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;false&lt;/code&gt;&lt;/strong&gt; after evaluation.&lt;/p&gt;

&lt;p&gt;In this article, you will find &lt;strong&gt;Relational&lt;/strong&gt; operators provided by Dart.&lt;/p&gt;

&lt;h1&gt;
  
  
  Relational operators
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;All of these relational operators are binary operators.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Less than&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x == y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;=&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Less than or equal to&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x != y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Greater than&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x == y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;gt;=&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Greater than or equal to&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x != y&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// create variables&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// value of a and b&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// &amp;gt; operator&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

  &lt;span class="c1"&gt;// &amp;lt; operator&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;

  &lt;span class="c1"&gt;// &amp;gt;= operator&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

  &lt;span class="c1"&gt;// &amp;lt;= operator&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the complete post on our site &lt;a href="https://meshworld.in/dart-relational-operators/"&gt;Dart - Relational Operators&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read others post on our site &lt;a href="https://meshworld.in"&gt;MeshWorld&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you like this!&lt;/p&gt;

&lt;p&gt;Keep helping and happy 😄 coding&lt;/p&gt;

</description>
      <category>dart</category>
      <category>operators</category>
      <category>programming</category>
      <category>code</category>
    </item>
  </channel>
</rss>
