Author : HASSAN MD TAREQ | Updated : 2023/02/18

Data type and variable

// Declaring variable
string userName = "HoverMind";
int userId = 1001;

// Type Inference
var userName = "HoverMind"; // "string" type is inferred from value
var userId = 1001; // "int" type is inferred from value

// By default type is inferred from value (no need to explicitly mention data type)
let userName = "HoverMind";
let userId = 1001;

// Declaring variable
let userName: string = "HoverMind";
let userId: number = 1001;

// Type Inference
let userName = "HoverMind";
let userId = 1001;

// Declaring variable
char userName[] = "HoverMind";
int userId = 1001;

// C does not have type inference

Formatting and format specifier

// pending

// pending

// pending

// pending