How to declare variable in DART

declare variable DART : Declaring A variable in DART is as simple as  declaring variable in any other language. To Declare variable in DART we have to specify with type. There are 5 builtin types are available.

declare variable DART

  1. int : Integer
  2. num : Number, it can hold integer, double etc
  3. bool : Boolean, only true or false
  4. Strung : String, any string
  5. var : universal type

declare variable DART

int variable1=123;
num variable2=234.56;
bool variable3=false;
String variable4="This is a string";
var variable5="var can accept string";
var variable6=789;

  print('first variable  is of type integer ${variable1}');
  print('second variable is of type number ${variable2}');
  print('Third variable is of type boolean ${variable3}');
  print('Fourth variable is of type String ${variable4}');
  print('Fifth variable is of type var ${variable5}');
  print('Sixth variable is of type var ${variable4}');

RUN and execute DART here

Online DART compiler

Leave a Reply

Your email address will not be published. Required fields are marked *