উদাহরণসহ TypeScript এর Increment and Decrement Operators

  TypeScript Increment and Decrement Operators with Example প্রিয় ডেভেলপারস ! আসসালামু আলাইকুম , আশা করি ভালো আছেন । TypeScript Operators...

 TypeScript Increment and Decrement Operators with Example

উদাহরণসহ TypeScript এর Increment and Decrement Operators

প্রিয় ডেভেলপারস! আসসালামু আলাইকুম, আশা করি ভালো আছেন TypeScript Operators সাধারণত JavaScript Operators এর মতোই কিন্তু TypeScript ডাটার স্ট্যাটিক টাইপ প্রদান করে থাকে যার ফলে কোডিং Error হওয়ার সম্ভাবনা অনেকাংশ কমে যায় নিম্নে TypeScript Operators এর Increment and Decrement Operators উদাহরণসহ বর্ণনা করা হলো -

 

লক্ষণীয় যে, TypeScript Operators সম্পর্কে বিস্তারিত জানুন এখানে।

 

Increment and Decrement Operators


++ (Increment) – ভ্যালুর মান এক-এক করে বৃদ্ধি করার জন্য ব্যবহার করা হয়

[

let count: number = 5;

// Using the increment operator to increase the value of 'count' by 1

count++;

console.log("After incrementing, count is:", count); // Output: After incrementing, count is: 6

]


[

let x: number = 3;

let y: number = 3;

let result1 = x++; // Post-increment, result1 is assigned the current value of x, then x is incremented

let result2 = ++y; // Pre-increment, y is incremented first, then result2 is assigned the new value of y

console.log("Post-increment result:", result1); // Output: Post-increment result: 3

console.log("Pre-increment result:", result2);  // Output: Pre-increment result: 4

console.log("After post-increment, x is:", x);   // Output: After post-increment, x is: 4

console.log("After pre-increment, y is:", y);    // Output: After pre-increment, y is: 4


]


-- (Decrement) - ভ্যালুর মান এক-এক করে কমানোর জন্য ব্যবহার করা হয়

[

let value: number = 10;

// Using the decrement operator to decrease the value of 'value' by 1

value--;

console.log("After decrementing, value is:", value); // Output: After decrementing, value is: 9

]


[

let x: number = 3;

let y: number = 3;

let result1 = x--; // Post-decrement, result1 is assigned the current value of x, then x is decremented

let result2 = --y; // Pre-decrement, y is decremented first, then result2 is assigned the new value of y

console.log("Post-decrement result:", result1); // Output: Post-decrement result: 3

console.log("Pre-decrement result:", result2);  // Output: Pre-decrement result: 2

console.log("After post-decrement, x is:", x);   // Output: After post-decrement, x is: 2

console.log("After pre-decrement, y is:", y);    // Output: After pre-decrement, y is: 2

]


[

let counter: number = 0;

// Using a loop with the increment operator

for (let i = 0; i < 5; i++) {

    console.log(`Iteration ${i + 1}: Counter is ${counter}`);

    counter++;

}


// Using a loop with the decrement operator

for (let j = 5; j > 0; j--) {

    console.log(`Iteration ${6 - j}: Counter is ${counter}`);

    counter--;

}

]

 

 

আশা করি আপনি আজকের এই ব্লগটি মনোযোগ সহকারে পড়েছেন আজকের ব্লগটি আপনার কাছে কেমন লেগেছে অবশ্যই  কমেন্ট করে জানাবেন, আর যদি কোন ভূল হয়ে থাকে তাহলে ক্ষমা সুন্দর দৃষ্টিতে দেখবেন এবং কোথায় ভূল হয়েছে কমেন্ট করে জানাবেনপোষ্টে উল্লিখিত কোনো অংশ যদি বুঝতে সমস্যা হয়, তাহলে কমেন্ট বক্সে জানিয়ে দিনইনশাআল্লাহ্‌, সমস্যা সমাধানের চেষ্টা করবো আর ওয়েবসাইটটি বন্ধুদের মাঝে শেয়ার করবেন আজকের মতই এখানেই বিদায় নিলাম, ইনশাআল্লাহ দেখা হবে অন্য কোন ব্লগে ভালো থাকবেন সুস্থ থাকবেন আল্লাহ হাফেয

COMMENTS

Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content