{"id":88546,"date":"2025-07-01T18:20:40","date_gmt":"2025-07-01T11:20:40","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=88546"},"modified":"2025-07-01T18:20:43","modified_gmt":"2025-07-01T11:20:43","slug":"objective-c-tutorial","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/","title":{"rendered":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#Vi_sao_ban_van_nen_hoc_Objective-C_du_%E2%80%9Cngon_ngu_da_cu%E2%80%9D\" >V\u00ec sao b\u1ea1n v\u1eabn n\u00ean h\u1ecdc Objective-C d\u00f9 \u201cng\u00f4n ng\u1eef \u0111\u00e3 c\u0169\u201d?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#Objective-C_tutorial_Lo_trinh_14_ngay_tu_hoc\" >Objective-C tutorial: L\u1ed9 tr\u00ecnh 14 ng\u00e0y t\u1ef1 h\u1ecdc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#Cac_cau_hoi_thuong_gap_ve_Objective-C_tutorial\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Objective-C tutorial<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#Tong_ket\" >T\u1ed5ng k\u1ebft<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><strong><em>D\u00f9 Swift \u0111\u00e3 tr\u1edf th\u00e0nh ng\u00f4n ng\u1eef ch\u00ednh th\u1ee9c khi ph\u00e1t tri\u1ec3n c\u00e1c \u1ee9ng d\u1ee5ng tr\u00ean n\u1ec1n t\u1ea3ng Apple th\u00ec vi\u1ec7c h\u1ecdc v\u00e0 hi\u1ec3u v\u1ec1 Objective-C v\u1eabn mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch cho l\u1eadp tr\u00ecnh vi\u00ean. N\u1ebfu b\u1ea1n l\u00e0 ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u t\u00ecm hi\u1ec3u v\u1ec1 ng\u00f4n ng\u1eef n\u00e0y, h\u00e3y c\u00f9ng ITviec th\u1ef1c hi\u1ec7n th\u1eed th\u00e1ch 14 ng\u00e0y chinh ph\u1ee5c ng\u00f4n ng\u1eef Objective-C theo l\u1ed9 tr\u00ecnh Objective-C tutorial<\/em><\/strong> <strong><em>trong b\u00e0i vi\u1ebft n\u00e0y nh\u00e9.\u00a0<\/em><\/strong><\/p>\n\n\n\n<p>\u0110\u1ecdc b\u00e0i vi\u1ebft \u0111\u1ec3 hi\u1ec3u r\u00f5 h\u01a1n:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>V\u00ec sao b\u1ea1n v\u1eabn n\u00ean h\u1ecdc Objective-C?<\/li>\n\n\n\n<li>Objective-C tutorial: L\u1ed9 tr\u00ecnh 14 ng\u00e0y chinh ph\u1ee5c Objective-C\u00a0<\/li>\n\n\n\n<li>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Objective-C<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc th\u00eam: <strong><a href=\"https:\/\/itviec.com\/blog\/objective-c-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Objective-C l\u00e0 g\u00ec? C\u00f3 c\u00f2n ph\u00f9 h\u1ee3p \u0111\u1ec3 h\u1ecdc trong n\u0103m 2025?<\/a><\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-vi-sao-b\u1ea1n-v\u1eabn-nen-h\u1ecdc-objective-c-du-ngon-ng\u1eef-da-cu\"><span class=\"ez-toc-section\" id=\"Vi_sao_ban_van_nen_hoc_Objective-C_du_%E2%80%9Cngon_ngu_da_cu%E2%80%9D\"><\/span><strong>V\u00ec sao b\u1ea1n v\u1eabn n\u00ean h\u1ecdc Objective-C d\u00f9 \u201cng\u00f4n ng\u1eef \u0111\u00e3 c\u0169\u201d?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Theo <a href=\"https:\/\/itviec.com\/bao-cao\/luong-it-va-thi-truong-tuyen-dung-it-vietnam\" target=\"_blank\" rel=\"noreferrer noopener\">B\u00e1o c\u00e1o 2024 &#8211; 2025 t\u1eeb ITviec<\/a>, hi\u1ec7n nay ch\u1ec9 c\u00f3 kho\u1ea3ng 8% l\u1eadp tr\u00ecnh vi\u00ean di \u0111\u1ed9ng (mobile developer) c\u00f2n s\u1eed d\u1ee5ng Objective-C, m\u1ed9t con s\u1ed1 khi\u00eam t\u1ed1n nh\u1ea5t l\u00e0 \u0111\u1ed1i v\u1edbi m\u1ed9t ng\u00f4n ng\u1eef t\u1eebng l\u00e0 n\u1ec1n t\u1ea3ng c\u1ee7a c\u1ea3 h\u1ec7 sinh th\u00e1i Apple.<\/p>\n\n\n\n<p>Tuy nhi\u00ean, ch\u00ednh s\u1ef1 khan hi\u1ebfm \u0111\u00f3 l\u1ea1i m\u1edf ra c\u01a1 h\u1ed9i l\u1edbn cho nh\u1eefng ai th\u1eadt s\u1ef1 hi\u1ec3u v\u00e0 l\u00e0m ch\u1ee7 \u0111\u01b0\u1ee3c n\u00f3. L\u1ee3i th\u1ebf c\u1ee7a b\u1ea1n khi h\u1ecdc Objective-C l\u00e0:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Nhu c\u1ea7u b\u1ea3o tr\u00ec v\u00e0 n\u00e2ng c\u1ea5p \u1ee9ng d\u1ee5ng c\u0169:<\/strong> Nhi\u1ec1u c\u00f4ng ty v\u1eabn duy tr\u00ec c\u00e1c d\u1ef1 \u00e1n l\u1edbn s\u1eed d\u1ee5ng Objective-C. Vi\u1ec7c hi\u1ec3u r\u00f5 v\u00e0 s\u1eed d\u1ee5ng \u0111\u01b0\u1ee3c ng\u00f4n ng\u1eef Objective C n\u00e0y s\u1ebd gi\u00fap b\u1ea1n d\u1ec5 d\u00e0ng b\u1ea3o tr\u00ec, n\u00e2ng c\u1ea5p ho\u1eb7c t\u00edch h\u1ee3p c\u00e1c t\u00ednh n\u0103ng m\u1edbi v\u00e0o c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7n c\u00f3.<\/li>\n\n\n\n<li><strong>L\u1ee3i th\u1ebf khi l\u00e0m c\u00e1c d\u1ef1 \u00e1n chuy\u1ec3n \u0111\u1ed5i c\u00f4ng ngh\u1ec7:<\/strong> Hi\u1ec7n nay, c\u00e1c c\u00f4ng ty c\u00f4ng ngh\u1ec7 \u0111ang c\u00f3 xu h\u01b0\u1edbng chuy\u1ec3n \u0111\u1ed5i c\u00e1c s\u1ea3n ph\u1ea9m s\u1eed d\u1ee5ng Objective-C sang ng\u00f4n ng\u1eef m\u1edbi ph\u1ed5 th\u00f4ng h\u01a1n nh\u01b0 Swift, <a href=\"https:\/\/itviec.com\/blog\/flutter-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Flutter<\/a>, vi\u1ec7c hi\u1ec3u r\u00f5 ng\u00f4n ng\u1eef Objective-C gi\u00fap cho vi\u1ec7c chuy\u1ec3n \u0111\u1ed5i tr\u1edf n\u00ean d\u1ec5 d\u00e0ng h\u01a1n.<\/li>\n\n\n\n<li><strong>C\u1ea7u n\u1ed1i v\u1eefng ch\u1eafc \u0111\u1ebfn Swift:<\/strong> Vi\u1ec7c n\u1eafm v\u1eefng Objective-C gi\u00fap b\u1ea1n hi\u1ec3u r\u00f5 h\u01a1n v\u1ec1 c\u00e1ch ho\u1ea1t \u0111\u1ed9ng c\u1ee7a c\u00e1c \u1ee9ng d\u1ee5ng iOS\/macOS v\u00e0 d\u1ec5 d\u00e0ng chuy\u1ec3n \u0111\u1ed5i ho\u1eb7c t\u00edch h\u1ee3p m\u00e3 gi\u1eefa hai ng\u00f4n ng\u1eef.&nbsp;<\/li>\n\n\n\n<li><strong>Hi\u1ec3u s\u00e2u v\u1ec1 h\u1ec7 sinh th\u00e1i Apple:<\/strong> Objective-C l\u00e0 n\u1ec1n t\u1ea3ng c\u1ee7a nhi\u1ec1u framework c\u1ed1t l\u00f5i nh\u01b0 Cocoa v\u00e0 Cocoa Touch. N\u1eafm v\u1eefng Objective-C \u0111\u1ed3ng ngh\u0129a v\u1edbi vi\u1ec7c b\u1ea1n c\u00f3 kh\u1ea3 n\u0103ng l\u00e0m vi\u1ec7c hi\u1ec7u qu\u1ea3 v\u1edbi c\u00e1c API h\u1ec7 th\u1ed1ng l\u00e2u \u0111\u1eddi m\u00e0 nhi\u1ec1u th\u01b0 vi\u1ec7n hi\u1ec7n nay v\u1eabn d\u1ef1a v\u00e0o.<\/li>\n\n\n\n<li><strong>V\u1eabn c\u00f3 nhu c\u1ea7u tuy\u1ec3n d\u1ee5ng v\u1edbi m\u1ee9c l\u01b0\u01a1ng c\u1ea1nh tranh: <\/strong>D\u00f9 kh\u00f4ng c\u00f2n ph\u1ed5 bi\u1ebfn nh\u01b0 tr\u01b0\u1edbc, l\u1eadp tr\u00ecnh vi\u00ean Objective-C v\u1eabn \u0111\u01b0\u1ee3c s\u0103n \u0111\u00f3n t\u1ea1i c\u00e1c c\u00f4ng ty duy tr\u00ec \u1ee9ng d\u1ee5ng c\u0169 ho\u1eb7c m\u1edf r\u1ed9ng t\u00ednh n\u0103ng tr\u00ean c\u00e1c n\u1ec1n t\u1ea3ng hi\u1ec7n t\u1ea1i. <a href=\"https:\/\/itviec.com\/bao-cao\/luong-it-va-thi-truong-tuyen-dung-it-vietnam\" target=\"_blank\" rel=\"noreferrer noopener\">Theo B\u00e1o C\u00e1o L\u01b0\u01a1ng &amp; Th\u1ecb Tr\u01b0\u1eddng Tuy\u1ec3n D\u1ee5ng IT 2024-2025<\/a> c\u1ee7a ITviec, l\u1eadp tr\u00ecnh vi\u00ean Objective-C v\u1edbi kinh nghi\u1ec7m t\u1eeb 8 n\u0103m tr\u1edf l\u00ean c\u00f3 th\u1ec3 \u0111\u1ea1t m\u1ee9c l\u01b0\u01a1ng l\u00ean \u0111\u1ebfn 100 tri\u1ec7u \u0111\u1ed3ng m\u1ed7i th\u00e1ng. \u0110\u00e2y l\u00e0 con s\u1ed1 \u1ea5n t\u01b0\u1ee3ng, ph\u1ea3n \u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a nh\u1eefng chuy\u00ean gia c\u00f3 k\u1ef9 n\u0103ng v\u00e0 kinh nghi\u1ec7m s\u00e2u r\u1ed9ng.<\/li>\n<\/ul>\n\n\n\n<p>N\u1ebfu b\u1ea1n mu\u1ed1n t\u1eadn d\u1ee5ng c\u00e1c l\u1ee3i th\u1ebf tr\u00ean, h\u00e3y b\u1eaft \u0111\u1ea7u v\u1edbi l\u1ed9 tr\u00ecnh 14 ng\u00e0y h\u1ecdc \u201ct\u1ea5t t\u1ea7n t\u1eadt\u201d v\u1ec1 ng\u00f4n ng\u1eef Objective-C d\u01b0\u1edbi \u0111\u00e2y nh\u00e9:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-objective-c-tutorial-l\u1ed9-trinh-14-ngay-t\u1ef1-h\u1ecdc\"><span class=\"ez-toc-section\" id=\"Objective-C_tutorial_Lo_trinh_14_ngay_tu_hoc\"><\/span><strong>Objective-C tutorial: L\u1ed9 tr\u00ecnh 14 ng\u00e0y t\u1ef1 h\u1ecdc<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ngay-1-lam-quen-v\u1edbi-objective-c-va-cai-d\u1eb7t-moi-tr\u01b0\u1eddng\"><strong>Ng\u00e0y 1: L\u00e0m quen v\u1edbi Objective-C v\u00e0 c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng<\/strong><\/h3>\n\n\n\n<p>\u0110\u1ec3 b\u1eaft \u0111\u1ea7u h\u1ecdc l\u1eadp tr\u00ecnh v\u1edbi Objective-C, tr\u01b0\u1edbc h\u1ebft b\u1ea1n c\u1ea7n thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng ph\u00f9 h\u1ee3p.<\/p>\n\n\n\n<p>H\u00e3y l\u00e0m c\u00e1c b\u01b0\u1edbc sau \u0111\u1ec3 c\u00e0i \u0111\u1eb7t Objective-C v\u00e0 ch\u1ea1y ch\u01b0\u01a1ng tr\u00ecnh \u0111\u1ea7u ti\u00ean:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>B\u01b0\u1edbc 1 &#8211; C\u00e0i \u0111\u1eb7t Xcode<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u0110\u00e2y l\u00e0 IDE ch\u00ednh th\u1ee9c c\u1ee7a Apple d\u00e0nh ri\u00eang \u0111\u1ec3 ph\u00e1t tri\u1ec3n ph\u1ea7n m\u1ec1m tr\u00ean macOS, iOS, iPadOS v\u00e0 watchOS. \u0110\u1ec3 c\u00e0i \u0111\u1eb7t Xcode, b\u1ea1n ch\u1ec9 c\u1ea7n m\u1edf App Store, r\u1ed3i t\u00ecm ki\u1ebfm Xcode v\u00e0 nh\u1ea5n Install. Sau khi qu\u00e1 tr\u00ecnh c\u00e0i \u0111\u1eb7t ho\u00e0n t\u1ea5t, h\u00e3y m\u1edf Xcode ngay l\u1eadp t\u1ee9c. Trong l\u1ea7n m\u1edf \u0111\u1ea7u ti\u00ean n\u00e0y, h\u1ec7 th\u1ed1ng s\u1ebd t\u1ef1 \u0111\u1ed9ng c\u1ea5u h\u00ecnh cho b\u1ea1n.<\/p>\n\n\n\n<p>Sau khi c\u00e0i \u0111\u1eb7t xong, b\u1ea1n c\u00f3 th\u1ec3 m\u1edf Xcode v\u00e0 l\u00e0m quen v\u1edbi thanh toolbar c\u00f9ng c\u00e1c file m\u1eb7c \u0111\u1ecbnh c\u01a1 b\u1ea3n trong m\u1ed9t project iOS.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Thanh toolbar n\u1eb1m \u1edf ph\u00eda tr\u00ean c\u1eeda s\u1ed5 Xcode. B\u1ea1n c\u00f3 th\u1ec3 ch\u1ecdn thi\u1ebft b\u1ecb gi\u1ea3 l\u1eadp (simulator), ch\u1ea1y\/d\u1eebng \u1ee9ng d\u1ee5ng ho\u1eb7c theo d\u00f5i tr\u1ea1ng th\u00e1i build.<\/li>\n\n\n\n<li>Navigator (b\u00ean tr\u00e1i) hi\u1ec3n th\u1ecb danh s\u00e1ch file. B\u1ea1n c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng truy c\u1eadp c\u00e1c th\u00e0nh ph\u1ea7n nh\u01b0 AppDelegate (qu\u1ea3n l\u00fd v\u00f2ng \u0111\u1eddi \u1ee9ng d\u1ee5ng), ViewController (vi\u1ebft logic cho giao di\u1ec7n), Main.storyboard (c\u00f4ng c\u1ee5 k\u00e9o th\u1ea3 giao di\u1ec7n),&#8230;<\/li>\n<\/ul>\n\n\n\n<p>L\u00e0m quen v\u1edbi c\u00e1c ph\u1ea7n n\u00e0y gi\u00fap b\u1ea1n hi\u1ec3u \u0111\u01b0\u1ee3c c\u00e1ch \u1ee9ng d\u1ee5ng iOS v\u1eadn h\u00e0nh v\u00e0 bi\u1ebft n\u00ean \u0111i\u1ec1u ch\u1ec9nh \u1edf \u0111\u00e2u khi vi\u1ebft code.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>B\u01b0\u1edbc 2 &#8211; C\u00e0i \u0111\u1eb7t Xcode Command Line Tools<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Xcode Command Line l\u00e0 c\u00f4ng c\u1ee5 gi\u00fap b\u1ea1n thao t\u00e1c d\u1ec5 d\u00e0ng h\u01a1n trong m\u00f4i tr\u01b0\u1eddng Objective-C, nh\u1ea5t l\u00e0 khi b\u1ea1n kh\u00f4ng mu\u1ed1n d\u00f9ng to\u00e0n b\u1ed9 c\u1ee7a Xcode ho\u1eb7c ch\u1ec9 c\u1ea7n bi\u00ean d\u1ecbch nhanh m\u1ed9t t\u1eadp tin Objective-C.<\/p>\n\n\n\n<p>\u0110\u1ec3 c\u00e0i \u0111\u1eb7t c\u00f4ng c\u1ee5 n\u00e0y, b\u1ea1n m\u1edf Terminal v\u00e0 ch\u1ea1y l\u1ec7nh: <code>xcode-select --install<\/code>.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ngay-2-3-va-4-tim-hi\u1ec3u-v\u1ec1-ki\u1ec3u-d\u1eef-li\u1ec7u-h\u1eb1ng-s\u1ed1-bi\u1ebfn-va-toan-t\u1eed-objective-c\"><strong>Ng\u00e0y 2, 3 v\u00e0 4: T\u00ecm hi\u1ec3u v\u1ec1 ki\u1ec3u d\u1eef li\u1ec7u, h\u1eb1ng s\u1ed1, bi\u1ebfn v\u00e0 to\u00e1n t\u1eed Objective-C<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-ki\u1ec3u-d\u1eef-li\u1ec7u-trong-objective-c\"><strong>Ki\u1ec3u d\u1eef li\u1ec7u trong Objective-C<\/strong><\/h4>\n\n\n\n<p>Ki\u1ec3u d\u1eef li\u1ec7u trong Objective-C \u0111\u01b0\u1ee3c ph\u00e2n th\u00e0nh 2 lo\u1ea1i ch\u00ednh l\u00e0 nh\u00f3m ki\u1ec3u d\u1eef li\u1ec7u nguy\u00ean th\u1ee7y (Primitive Data Types) v\u00e0 nh\u00f3m ki\u1ec3u d\u1eef li\u1ec7u \u0111\u1ed1i t\u01b0\u1ee3ng (Object Data Types).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td colspan=\"2\"><strong>Ki\u1ec3u d\u1eef li\u1ec7u<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td rowspan=\"5\"><strong>Ki\u1ec3u d\u1eef li\u1ec7u nguy\u00ean th\u1ee7y<\/strong><\/td><td><strong>int<\/strong><\/td><td>S\u1ed1 nguy\u00ean<\/td><td><code>int age = 25;\u00a0<\/code><\/td><\/tr><tr><td><strong>float<\/strong><\/td><td>S\u1ed1 th\u1ef1c ch\u00ednh x\u00e1c \u0111\u01a1n<\/td><td><code>float pi = 3.14f;\u00a0<\/code><\/td><\/tr><tr><td><strong>double<\/strong><\/td><td>S\u1ed1 th\u1ef1c ch\u00ednh x\u00e1c k\u00e9p<\/td><td><code>double price = 99.99;<\/code><\/td><\/tr><tr><td><strong>char<\/strong><\/td><td>K\u00fd t\u1ef1 \u0111\u01a1n<\/td><td><code>char grade = 'A';<\/code><\/td><\/tr><tr><td><strong>BOOL<\/strong><\/td><td>Boolean (Yes or No)<\/td><td><code>BOOL isActive = YES;<\/code><\/td><\/tr><tr><td rowspan=\"4\"><strong>Ki\u1ec3u d\u1eef li\u1ec7u \u0111\u1ed1i t\u01b0\u1ee3ng<\/strong><\/td><td><strong>NSNumber<\/strong><\/td><td>Bao g\u00f3i gi\u00e1 tr\u1ecb nguy\u00ean th\u1ee7y nh\u01b0 int, float, BOOL th\u00e0nh Object<\/td><td><code>NSNumber *num = @42;<\/code><\/td><\/tr><tr><td><strong>NSString<\/strong><\/td><td>Chu\u1ed7i k\u00fd t\u1ef1<\/td><td><code>NSString *name = @\"Linh\";<\/code><\/td><\/tr><tr><td><strong>NSArray<\/strong><\/td><td>M\u1ea3ng c\u00e1c ph\u1ea7n t\u1eed object<\/td><td><code>NSArray *colors = @[@\"Red\", @\"Green\"];<\/code><\/td><\/tr><tr><td><strong>NSDictionary<\/strong><\/td><td>T\u1eeb \u0111i\u1ec3n (key-value pairs)<\/td><td><code>NSDictionary *info = @{@\"name\": @\"Linh\", @\"age\": @25};<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-h\u1eb1ng-s\u1ed1-trong-objective-c\"><strong>H\u1eb1ng s\u1ed1 trong Objective-C<\/strong><\/h4>\n\n\n\n<p>H\u1eb1ng s\u1ed1 trong Objective-C l\u00e0 c\u00e1c gi\u00e1 tr\u1ecb kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i sau khi \u0111\u00e3 thi\u1ebft l\u1eadp. Ch\u00fang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u lo\u1ea1i d\u1eef li\u1ec7u nh\u01b0 s\u1ed1, chu\u1ed7i v\u00e0 boolean.<\/p>\n\n\n\n<p>\u0110\u1ec3 khai b\u00e1o h\u1eb1ng s\u1ed1 trong Objective-C, b\u1ea1n s\u1eed d\u1ee5ng t\u1eeb kh\u00f3a const. H\u1eb1ng s\u1ed1 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c khai b\u00e1o \u1edf \u0111\u1ea7u h\u00e0m, ph\u01b0\u01a1ng th\u1ee9c ho\u1eb7c \u1edf c\u1ea5p \u0111\u1ed9 to\u00e0n c\u1ee5c.&nbsp;<\/p>\n\n\n\n<p>C\u00fa ph\u00e1p:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const int MAX_COUNT = 100<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>MAX_COUNT<\/code> l\u00e0 t\u00ean c\u1ee7a h\u1eb1ng s\u1ed1 v\u00e0 100 l\u00e0 gi\u00e1 tr\u1ecb m\u00e0 h\u1eb1ng s\u1ed1 \u0111\u01b0\u1ee3c \u0111\u1eb7t th\u00e0nh.&nbsp;<\/li>\n\n\n\n<li>T\u1eeb kh\u00f3a <code>int<\/code> ch\u1ec9 \u0111\u1ecbnh ki\u1ec3u d\u1eef li\u1ec7u c\u1ee7a h\u1eb1ng s\u1ed1.<\/li>\n<\/ul>\n\n\n\n<p>C\u00f3 nhi\u1ec1u lo\u1ea1i h\u1eb1ng s\u1ed1 ph\u1ed5 bi\u1ebfn trong Objective-C. C\u00e1c lo\u1ea1i ph\u1ed5 bi\u1ebfn nh\u1ea5t g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1eb1ng s\u1ed1 s\u1ed1 h\u1ecdc (Numeric Constants)<\/strong><\/li>\n<\/ul>\n\n\n\n<p>L\u00e0 c\u00e1c h\u1eb1ng s\u1ed1 bi\u1ec3u di\u1ec5n c\u00e1c gi\u00e1 tr\u1ecb s\u1ed1 nh\u01b0 s\u1ed1 nguy\u00ean, s\u1ed1 d\u1ea5u ph\u1ea9y \u0111\u1ed9ng v\u00e0 s\u1ed1 ph\u1ee9c. H\u1eb1ng s\u1ed1 s\u1ed1 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c vi\u1ebft b\u1eb1ng k\u00fd hi\u1ec7u th\u1eadp ph\u00e2n, b\u00e1t ph\u00e2n ho\u1eb7c th\u1eadp l\u1ee5c ph\u00e2n chu\u1ea9n.<\/p>\n\n\n\n<p><em><strong>V\u00ed d\u1ee5:<\/strong> C\u00e1ch khai b\u00e1o v\u00e0 s\u1eed d\u1ee5ng h\u1eb1ng s\u1ed1 s\u1ed1 h\u1ecdc (numeric constant) trong ng\u00f4n ng\u1eef Objective-C<\/em><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate numeric constant\n#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) \n{\nNSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n    \/\/ Numeric constant\n    const int MAX_HEIGHT = 100;\n    NSLog(@\"Max Height: %d\", MAX_HEIGHT);\n    &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u201cMax Height: 100\u201d<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1eb1ng s\u1ed1 chu\u1ed7i (String Constants)<\/strong><\/li>\n<\/ul>\n\n\n\n<p>L\u00e0 c\u00e1c h\u1eb1ng s\u1ed1 bi\u1ec3u di\u1ec5n m\u1ed9t chu\u1ed7i k\u00fd t\u1ef1, ch\u1eb3ng h\u1ea1n nh\u01b0 t\u1eeb ho\u1eb7c c\u1ee5m t\u1eeb. H\u1eb1ng chu\u1ed7i c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c vi\u1ebft b\u1eb1ng d\u1ea5u ngo\u1eb7c k\u00e9p (&#8220;) ho\u1eb7c d\u1ea5u ngo\u1eb7c \u0111\u01a1n (&#8216;) v\u00e0 c\u00f3 th\u1ec3 ch\u1ee9a b\u1ea5t k\u1ef3 t\u1ed5 h\u1ee3p n\u00e0o c\u1ee7a c\u00e1c ch\u1eef c\u00e1i, s\u1ed1 v\u00e0 k\u00fd t\u1ef1 \u0111\u1eb7c bi\u1ec7t.<\/p>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5:<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate string constant\n#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) \n{\n    NSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n    \/\/ String constant\n    NSString * const GREETING = @\"Hello, World!\";\n    NSLog(@\"%@\", GREETING);\n    &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello, World!<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1eb1ng s\u1ed1 boolean (Boolean Constants)<\/strong><\/li>\n<\/ul>\n\n\n\n<p>L\u00e0 c\u00e1c h\u1eb1ng s\u1ed1 bi\u1ec3u di\u1ec5n gi\u00e1 tr\u1ecb \u0111\u00fang ho\u1eb7c sai. H\u1eb1ng s\u1ed1 Boolean c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c vi\u1ebft b\u1eb1ng t\u1eeb kh\u00f3a YES ho\u1eb7c NO, ho\u1eb7c t\u1eeb kh\u00f3a TRUE ho\u1eb7c FALSE.<\/p>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5:<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate boolean constant\n#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) \n{\n    NSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n    \/\/ Boolean constant\n    const BOOL IS_VALID = YES;\n    NSLog(@\"Is Valid: %d\", IS_VALID);\n    &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Is Valid: 1<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1eb1ng s\u1ed1 \u0111\u1ed1i t\u01b0\u1ee3ng (Object Constants)<\/strong><\/li>\n<\/ul>\n\n\n\n<p>L\u00e0 c\u00e1c h\u1eb1ng s\u1ed1 bi\u1ec3u di\u1ec5n m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng. H\u1eb1ng s\u1ed1 \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c t\u1ea1o b\u1eb1ng c\u00e1c ph\u01b0\u01a1ng th\u1ee9c malloc v\u00e0 init v\u00e0 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef tham chi\u1ebfu \u0111\u1ebfn m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng.<\/p>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5:<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate object constant\n#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) \n{\n    NSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n    \/\/ Creating object constant\n    NSString * const PI = &#91;&#91;NSString alloc] initWithFormat:@\"%.2f\", M_PI];\n    NSLog(@\"Value of PI: %@\", PI);\n    &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Value of PI: 3.14<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"bien-variables-trong-objective-c\"><strong>Bi\u1ebfn (variables) trong Objective-C<\/strong><\/h4>\n\n\n\n<p>Bi\u1ebfn trong Objective-C l\u00e0 v\u00f9ng nh\u1edb c\u00f3 t\u00ean, \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef d\u1eef li\u1ec7u c\u00f3 th\u1ec3 thay \u0111\u1ed5i trong qu\u00e1 tr\u00ecnh ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c thi. M\u1ed7i bi\u1ebfn c\u00f3 m\u1ed9t ki\u1ec3u d\u1eef li\u1ec7u x\u00e1c \u0111\u1ecbnh, cho bi\u1ebft c\u00e1ch t\u1ed5 ch\u1ee9c v\u00e0 bi\u1ec3u di\u1ec5n gi\u00e1 tr\u1ecb trong b\u1ed9 nh\u1edb, \u0111\u1ed3ng th\u1eddi quy\u1ebft \u0111\u1ecbnh c\u00e1c ph\u00e9p to\u00e1n c\u00f3 th\u1ec3 \u00e1p d\u1ee5ng l\u00ean bi\u1ebfn \u0111\u00f3.<\/p>\n\n\n\n<p>Bi\u1ebfn trong Objective-C c\u00f3 c\u00e1c ki\u1ec3u c\u01a1 b\u1ea3n nh\u01b0 sau:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>STT<\/strong><\/td><td><strong>Ki\u1ec3u bi\u1ebfn<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><\/tr><tr><td><strong>1<\/strong><\/td><td><strong>char<\/strong><\/td><td>\u0110\u00e2y l\u00e0 ki\u1ec3u d\u1eef li\u1ec7u 8-bit, c\u00f3 k\u00edch th\u01b0\u1edbc m\u1ed9t byte.<\/td><\/tr><tr><td><strong>2<\/strong><\/td><td><strong>int<\/strong><\/td><td>Bao g\u1ed3m s\u1ed1 nguy\u00ean, th\u01b0\u1eddng c\u00f3 k\u00edch th\u01b0\u1edbc 2 ho\u1eb7c 4 byte.<\/td><\/tr><tr><td><strong>3<\/strong><\/td><td><strong>float<\/strong><\/td><td>\u0110\u1ea1i di\u1ec7n cho gi\u00e1 tr\u1ecb d\u1ea5u ph\u1ea9y \u0111\u1ed9ng v\u1edbi \u0111\u1ed9 ch\u00ednh x\u00e1c \u0111\u01a1n (single-precision).<\/td><\/tr><tr><td><strong>4<\/strong><\/td><td><strong>double<\/strong><\/td><td>\u0110\u1ea1i di\u1ec7n cho gi\u00e1 tr\u1ecb d\u1ea5u ph\u1ea9y \u0111\u1ed9ng v\u1edbi \u0111\u1ed9 ch\u00ednh x\u00e1c k\u00e9p (double-precision).<\/td><\/tr><tr><td><strong>5<\/strong><\/td><td><strong>boolean<\/strong><\/td><td>\u0110\u1ea1i di\u1ec7n cho gi\u00e1 tr\u1ecb \u0111\u00fang (true) ho\u1eb7c sai (false).&nbsp;Trong C99, d\u00f9ng bool v\u1edbi true\/false sau khi #include &lt;stdbool.h&gt;.Trong Objective-C, d\u00f9ng BOOL v\u1edbi gi\u00e1 tr\u1ecb YES\/NO, th\u01b0\u1eddng d\u00f9ng trong c\u00e1c \u1ee9ng d\u1ee5ng iOS\/macOS.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u0110\u1ec3 khai b\u00e1o v\u00e0 kh\u1edfi t\u1ea1o m\u1ed9t bi\u1ebfn trong Objective-C, b\u1ea1n s\u1eed d\u1ee5ng c\u00fa ph\u00e1p:&nbsp;<\/p>\n\n\n\n<p><code>type var_name = value<\/code><\/p>\n\n\n\n<p>Trong \u0111\u00f3:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>type<\/code> l\u00e0 ki\u1ec3u d\u1eef li\u1ec7u c\u1ee7a bi\u1ebfn<\/li>\n\n\n\n<li><code>var_name<\/code> l\u00e0 t\u00ean bi\u1ebfn do l\u1eadp tr\u00ecnh vi\u00ean \u0111\u1eb7t, d\u00f9ng \u0111\u1ec3 tham chi\u1ebfu v\u00f9ng nh\u1edb ch\u1ee9a gi\u00e1 tr\u1ecb<\/li>\n\n\n\n<li><code>value<\/code> l\u00e0 gi\u00e1 tr\u1ecb \u0111\u01b0\u1ee3c g\u00e1n cho bi\u1ebfn t\u1ea1i th\u1eddi \u0111i\u1ec3m khai b\u00e1o<\/li>\n<\/ul>\n\n\n\n<p><em><strong>V\u00ed d\u1ee5: <\/strong>Khai b\u00e1o v\u00e0 \u0111\u1ecbnh ngh\u0129a c\u1ee7a m\u1ed9t bi\u1ebfn.&nbsp;<\/em><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int main () {\n  \/* variable definition: *\/\n  int a, b;\n  int c;\n  float f;\n   \/* actual initialization *\/\n  a = 10;\n  b = 20;\n  c = a + b;\n  NSLog(@\"value of c : %d \\n\", c);\n  f = 70.0\/3.0;\n  NSLog(@\"value of f : %f \\n\", f);\n return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2025-05-21 18:09:16.849 main&#91;127884:127884] value of c : 30 \n2025-05-21 18:09:16.849 main&#91;127884:127884] value of f : 23.333334 <\/code><\/pre>\n\n\n\n<p><strong>Gi\u1ea3i th\u00edch: <\/strong>Trong v\u00ed d\u1ee5 tr\u00ean, ch\u00fang ta khai b\u00e1o c\u00e1c bi\u1ebfn extern ki\u1ec3u int. Trong Objective-C, t\u1eeb kh\u00f3a extern cho ph\u00e9p khai b\u00e1o c\u00e1c bi\u1ebfn tr\u00ean to\u00e0n th\u1ebf gi\u1edbi. Sau \u0111\u00f3, trong ph\u01b0\u01a1ng th\u1ee9c <code>main()<\/code>, ba bi\u1ebfn ki\u1ec3u int l\u00e0 p, q v\u00e0 r \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a. Sau \u0111\u00f3, kh\u1edfi t\u1ea1o <code>r=p*q<\/code>, <code>p=7<\/code> v\u00e0 <code>q=5<\/code>, in \u0111\u1ea7u ra tr\u00ean b\u1ea3ng \u0111i\u1ec1u khi\u1ec3n.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toan-tu-operators-trong-objective-c\"><strong>To\u00e1n t\u1eed (Operators) trong Objective-C<\/strong><\/h4>\n\n\n\n<p>To\u00e1n t\u1eed l\u00e0 m\u1ed9t k\u00fd hi\u1ec7u cho tr\u00ecnh bi\u00ean d\u1ecbch bi\u1ebft ph\u00e9p to\u00e1n n\u00e0o c\u1ea7n th\u1ef1c hi\u1ec7n. Trong Objective-C, ch\u00fang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o bi\u1ec3u th\u1ee9c to\u00e1n h\u1ecdc b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng c\u00e1c bi\u1ebfn. C\u00e1c lo\u1ea1i to\u00e1n t\u1eed trong Objective-C g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed s\u1ed1 h\u1ecdc: <\/strong>Th\u1ef1c hi\u1ec7n ph\u00e9p to\u00e1n s\u1ed1 h\u1ecdc tr\u00ean c\u00e1c to\u00e1n h\u1ea1ng nh\u01b0 ph\u00e9p c\u1ed9ng (+), ph\u00e9p tr\u1eeb (-), ph\u00e9p nh\u00e2n (*), ph\u00e9p chia (\/),&#8230;&nbsp;<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><strong>+<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p c\u1ed9ng 2 to\u00e1n h\u1ea1ng<\/td><td>int a=5, b=7, c; c = a + b ; \/\/ c=12<\/td><\/tr><tr><td><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p tr\u1eeb 2 to\u00e1n h\u1ea1ng<\/td><td>int a=5, b=7, c; c = a &#8211; b ; \/\/ c=-2<\/td><\/tr><tr><td><strong>*<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p nh\u00e2n 2 to\u00e1n h\u1ea1ng<\/td><td>int a=5, b=7, c; c = a * b ; \/\/ c=35<\/td><\/tr><tr><td><strong>\/<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p chia 2 to\u00e1n h\u1ea1ng<\/td><td>int a=20, b=5, c; c = a \/ b ; \/\/ c=4<\/td><\/tr><tr><td><strong>%<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p chia v\u00e0 tr\u1ea3 v\u1ec1 ph\u1ea7n d\u01b0<\/td><td>int a=20, b=5, c; c = a % b ; \/\/ c=0<\/td><\/tr><tr><td><strong>+ +<\/strong><\/td><td>T\u0103ng gi\u00e1 tr\u1ecb to\u00e1n h\u1ea1ng l\u00ean 1Khi ++ \u0111\u01b0\u1ee3c \u0111\u1eb7t l\u00e0m h\u1eadu t\u1ed1 (a++: D\u00f9ng gi\u00e1 tr\u1ecb tr\u01b0\u1edbc, r\u1ed3i m\u1edbi t\u0103ng.Khi ++ \u0111\u01b0\u1ee3c \u0111\u1eb7t l\u00e0m ti\u1ec1n t\u1ed1 (++a): T\u0103ng tr\u01b0\u1edbc, r\u1ed3i m\u1edbi d\u00f9ng gi\u00e1 tr\u1ecb.<\/td><td>int a = 5; int b = a++; \/\/ b = 5, a = 6 (h\u1eadu t\u1ed1: g\u00e1n xong r\u1ed3i m\u1edbi t\u0103ng)int x = 5; int y = ++x; \/\/ x = 6, y = 6 (ti\u1ec1n t\u1ed1: t\u0103ng x r\u1ed3i m\u1edbi g\u00e1n)<\/td><\/tr><tr><td><strong>\u2013 \u2013<\/strong><\/td><td>Gi\u1ea3m gi\u00e1 tr\u1ecb to\u00e1n h\u1ea1ng \u0111i 1Khi &#8212; \u0111\u01b0\u1ee3c \u0111\u1eb7t l\u00e0m h\u1eadu t\u1ed1 (a\u2013): D\u00f9ng gi\u00e1 tr\u1ecb tr\u01b0\u1edbc, r\u1ed3i m\u1edbi gi\u1ea3m.Khi &#8212; \u0111\u01b0\u1ee3c \u0111\u1eb7t l\u00e0m ti\u1ec1n t\u1ed1 (&#8211;a): Gi\u1ea3m tr\u01b0\u1edbc, r\u1ed3i m\u1edbi d\u00f9ng gi\u00e1 tr\u1ecb.<\/td><td>int a = 6; int b = a&#8211;;&nbsp; \/\/ b = 6, a = 5&nbsp; (h\u1eadu t\u1ed1: g\u00e1n r\u1ed3i m\u1edbi gi\u1ea3m)int x = 6; int y = &#8211;x;&nbsp; \/\/ x = 5, y = 5&nbsp; (ti\u1ec1n t\u1ed1: gi\u1ea3m r\u1ed3i m\u1edbi g\u00e1n)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed s\u1ed1 h\u1ecdc:<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main() {\n   int a = 21;\n   int b = 10;\n   int c ;\n   c = a + b;\n   NSLog(@\"Line 1 - Value of c is %d\\n\", c );\n   c = a - b;\n   NSLog(@\"Line 2 - Value of c is %d\\n\", c );\n   c = a * b;\n   NSLog(@\"Line 3 - Value of c is %d\\n\", c );\n   c = a \/ b;\n   NSLog(@\"Line 4 - Value of c is %d\\n\", c );\n   c = a % b;\n   NSLog(@\"Line 5 - Value of c is %d\\n\", c );\n   c = a++; \n   NSLog(@\"Line 6 - Value of c is %d\\n\", c );\n   c = a--; \n   NSLog(@\"Line 7 - Value of c is %d\\n\", c );\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2025-05-21 18:18:29.069 main&#91;133696:133696] Line 1 - Value of c is 31\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 2 - Value of c is 11\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 3 - Value of c is 210\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 4 - Value of c is 2\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 5 - Value of c is 1\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 6 - Value of c is 21\n2025-05-21 18:18:29.069 main&#91;133696:133696] Line 7 - Value of c is 22<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed quan h\u1ec7 (to\u00e1n t\u1eed so s\u00e1nh): <\/strong>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 so s\u00e1nh hai gi\u00e1 tr\u1ecb v\u00e0 t\u00ecm ra s\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa hai gi\u00e1 tr\u1ecb nh\u01b0 b\u1eb1ng ( == ), l\u1edbn h\u01a1n ( &gt; ), nh\u1ecf h\u01a1n ( &lt; ),&#8230;<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td>= =<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a hai to\u00e1n h\u1ea1ng c\u00f3 b\u1eb1ng nhau hay kh\u00f4ng, n\u1ebfu b\u1eb1ng nhau th\u00ec \u0111i\u1ec1u ki\u1ec7n l\u00e0 \u0111\u00fang, n\u1ebfu kh\u00f4ng l\u00e0 sai.<\/td><td><code>int a=5,b=7; (a==b) \/\/ sai<\/code><\/td><\/tr><tr><td>!=<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a hai to\u00e1n h\u1ea1ng c\u00f3 b\u1eb1ng nhau hay kh\u00f4ng, n\u1ebfu c\u00e1c gi\u00e1 tr\u1ecb kh\u00f4ng gi\u1ed1ng nhau th\u00ec \u0111i\u1ec1u ki\u1ec7n tr\u1edf th\u00e0nh \u0111\u00fang, n\u1ebfu kh\u00f4ng th\u00ec tr\u1edf th\u00e0nh sai.<\/td><td><code>int a=5, b=7 (A!= B) \/\/ \u0110\u00fang<\/code><\/td><\/tr><tr><td>&gt;<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i l\u1edbn h\u01a1n gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i. N\u1ebfu gi\u00e1 tr\u1ecb l\u1edbn h\u01a1n th\u00ec \u0111i\u1ec1u ki\u1ec7n tr\u1edf th\u00e0nh \u0111\u00fang, n\u1ebfu kh\u00f4ng th\u00ec tr\u1edf th\u00e0nh sai.<\/td><td><code>int a=7,b =5; (a>b) \/\/ \u0111\u00fang<\/code><\/td><\/tr><tr><td>&lt;<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i nh\u1ecf h\u01a1n gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i. N\u1ebfu gi\u00e1 tr\u1ecb nh\u1ecf h\u01a1n th\u00ec \u0111i\u1ec1u ki\u1ec7n tr\u1edf th\u00e0nh \u0111\u00fang, n\u1ebfu kh\u00f4ng th\u00ec tr\u1edf th\u00e0nh sai.<\/td><td><code>int a=5,b=7; (a&lt;b) \/\/ \u0111\u00fang<\/code><\/td><\/tr><tr><td>&gt;=<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i v\u1edbi l\u1edbn h\u01a1n ho\u1eb7c b\u1eb1ng gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i. N\u1ebfu gi\u00e1 tr\u1ecb l\u1edbn h\u01a1n ho\u1eb7c b\u1eb1ng th\u00ec \u0111i\u1ec1u ki\u1ec7n tr\u1edf th\u00e0nh \u0111\u00fang, n\u1ebfu kh\u00f4ng tr\u1edf th\u00e0nh sai.<\/td><td><code>int a=7,b =7; (a>=b) \/\/ \u0111\u00fang<\/code><\/td><\/tr><tr><td>&lt;=<\/td><td>So s\u00e1nh gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i v\u1edbi nh\u1ecf h\u01a1n ho\u1eb7c b\u1eb1ng gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i; n\u1ebfu nh\u1ecf h\u01a1n ho\u1eb7c b\u1eb1ng gi\u00e1 tr\u1ecb th\u00ec \u0111i\u1ec1u ki\u1ec7n tr\u1edf th\u00e0nh \u0111\u00fang, ng\u01b0\u1ee3c l\u1ea1i tr\u1edf th\u00e0nh sai.<\/td><td><code>int a=5,b=5; (a&lt;=b) \/\/ \u0111\u00fang<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed quan h\u1ec7:<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main() {\n   int a = 21;\n   int b = 10;\n   if( a == b ) {\n      NSLog(@\"Line 1 - a is equal to b\\n\" );\n   } else {\n      NSLog(@\"Line 1 - a is not equal to b\\n\" );\n   }\n      if ( a &lt; b ) {\n      NSLog(@\"Line 2 - a is less than b\\n\" );\n   } else {\n      NSLog(@\"Line 2 - a is not less than b\\n\" );\n   } \n      if ( a &gt; b ) {\n      NSLog(@\"Line 3 - a is greater than b\\n\" );\n   } else {\n      NSLog(@\"Line 3 - a is not greater than b\\n\" );\n   }\n      \/* Lets change value of a and b *\/\n   a = 5;\n   b = 20;\n      if ( a &lt;= b ) {\n      NSLog(@\"Line 4 - a is either less than or equal to  b\\n\" );\n   }\n   \n   if ( b &gt;= a ) {\n      NSLog(@\"Line 5 - b is either greater than  or equal to b\\n\" );\n   }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2025-05-21 18:21:35.683 main&#91;134964:134964] Line 1 - a is not equal to b\n2025-05-21 18:21:35.683 main&#91;134964:134964] Line 2 - a is not less than b\n2025-05-21 18:21:35.683 main&#91;134964:134964] Line 3 - a is greater than b\n2025-05-21 18:21:35.683 main&#91;134964:134964] Line 4 - a is either less than or equal to  b\n2025-05-21 18:21:35.683 main&#91;134964:134964] Line 5 - b is either greater than  or equal to b<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed logic: <\/strong>To\u00e1n t\u1eed logic \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c ph\u00e9p to\u00e1n logic tr\u00ean to\u00e1n h\u1ea1ng. N\u00f3 tr\u1ea3 v\u1ec1 0 ho\u1eb7c 1.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td>&amp;&amp;<\/td><td>N\u1ebfu c\u1ea3 hai \u0111i\u1ec1u ki\u1ec7n \u0111\u1ec1u \u0111\u00fang th\u00ec \u0111i\u1ec1u ki\u1ec7n \u0111\u00f3 tr\u1edf th\u00e0nh \u0111\u00fang.<\/td><td>(1 &amp;&amp; 1) \/\/ \u0111\u00fang (1 &amp;&amp; 0) \/\/ sai (0 &amp;&amp; 1) \/\/ sai (0 &amp;&amp; 0) \/\/ sai<\/td><\/tr><tr><td>||<\/td><td>N\u1ebfu b\u1ea5t k\u1ef3 m\u1ed9t \u0111i\u1ec1u ki\u1ec7n n\u00e0o l\u00e0 \u0111\u00fang trong hai \u0111i\u1ec1u ki\u1ec7n th\u00ec \u0111i\u1ec1u ki\u1ec7n \u0111\u00f3 tr\u1edf th\u00e0nh \u0111\u00fang<\/td><td>(1 || 1) \/\/ \u0111\u00fang (1 || 0) \/\/ \u0111\u00fang (0 || 1) \/\/ \u0111\u00fang (0 || 0) \/\/ sai<\/td><\/tr><tr><td>!<\/td><td>N\u1ebfu \u0111i\u1ec1u ki\u1ec7n l\u00e0 \u0111\u00fang th\u00ec s\u1ebd tr\u1ea3 v\u1ec1 sai v\u00e0 ng\u01b0\u1ee3c l\u1ea1i.<\/td><td>!(1 &amp;&amp; 1) \/\/ sai !(1 &amp;&amp; 0) \/\/ \u0111\u00fang !(0 &amp;&amp; 1) \/\/ \u0111\u00fang !(0 &amp;&amp; 0) \/\/ \u0111\u00fang<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed logic<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\n\nint main(int argc, const char* argv&#91;]) {\n  \/\/ S\u1eed d\u1ee5ng c\u00fa ph\u00e1p @autoreleasepool m\u1edbi h\u01a1n, thay th\u1ebf cho NSAutoreleasePool\n  @autoreleasepool {\n    \/\/ Initializing two numbers\n    int n1 = 1, n2 = 1;\n\n    \/\/ Return 1 if both condition are true else return 0\n    NSLog(@\"LOGICAL AND = %d\\n\", (n1 &amp;&amp; n2));\n\n    \/\/ Return 1 if either of one or all conditions are true else return 0\n    NSLog(@\"LOGICAL OR = %d\\n\", (n1 || n2));\n\n    \/\/ Return 1 if condition is false else return 0\n    NSLog(@\"LOGICAL NOT = %d\\n\", (!n1));\n  }\n  return 0;\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-12-06 16:01:31.808 a.out&#91;1514:1514] LOGICAL AND = 1 \n2022-12-06 16:01:31.812 a.out&#91;1514:1514] LOGICAL OR = 1 \n2022-12-06 16:01:31.812 a.out&#91;1514:1514] LOGICAL NOT = 0<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed Bitwise: <\/strong>L\u00e0 c\u00e1c to\u00e1n t\u1eed th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh tr\u1ef1c ti\u1ebfp tr\u00ean t\u1eebng bit c\u1ee7a gi\u00e1 tr\u1ecb nh\u1ecb ph\u00e2n (g\u1ed3m c\u00e1c ch\u1eef s\u1ed1 0 v\u00e0 1). Ch\u00fang th\u01b0\u1eddng \u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 x\u1eed l\u00fd nhanh v\u00e0 hi\u1ec7u qu\u1ea3 c\u00e1c ph\u00e9p to\u00e1n li\u00ean quan \u0111\u1ebfn b\u1ed9 nh\u1edb, \u0111i\u1ec1u khi\u1ec3n ph\u1ea7n c\u1ee9ng ho\u1eb7c t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td>&amp;<\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p to\u00e1n AND gi\u1eefa c\u00e1c bit c\u1ee7a c\u1ea3 hai to\u00e1n h\u1ea1ng.<\/td><td>int a=5,b=7; (a &amp; b) \/\/ 0101 t\u1ee9c l\u00e0 5<\/td><\/tr><tr><td>|<\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p to\u00e1n OR gi\u1eefa c\u00e1c bit c\u1ee7a c\u1ea3 hai to\u00e1n h\u1ea1ng<\/td><td>int a=5,b=7; (a | b) \/\/ 0111 t\u1ee9c l\u00e0 7<\/td><\/tr><tr><td>^<\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p to\u00e1n XOR gi\u1eefa c\u00e1c bit c\u1ee7a c\u1ea3 hai to\u00e1n h\u1ea1ng.<\/td><td>int a=5,b=7; (a ^ b) \/\/ 0010 2<\/td><\/tr><tr><td>~<\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p ph\u1ee7 \u0111\u1ecbnh t\u1eebng bit (bitwise NOT). M\u1ed7i bit 0 th\u00e0nh 1, 1 th\u00e0nh 0. V\u1edbi s\u1ed1 nguy\u00ean c\u00f3 d\u1ea5u, k\u1ebft qu\u1ea3 l\u00e0 d\u1ea1ng b\u00f9 1 c\u1ee7a bi\u1ec3u di\u1ec5n b\u00f9 2, d\u1eabn \u0111\u1ebfn k\u1ebft qu\u1ea3 \u00e2m.<\/td><td>int a = 5; int b = ~a; \/\/ b = -6 V\u00ec a = 0000&#8230;0101 n\u00ean ~a = 1111&#8230;1010 (t\u1ee9c l\u00e0 -6 n\u1ebfu d\u00f9ng 32-bit int)<\/td><\/tr><tr><td>&lt;&lt;<\/td><td>D\u1ecbch chuy\u1ec3n c\u00e1c bit c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i sang ph\u00eda b\u00ean tr\u00e1i theo gi\u00e1 tr\u1ecb to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i<\/td><td>int a=5; a &lt;&lt; 2 \/\/ 10100 t\u1ee9c l\u00e0 20<\/td><\/tr><tr><td>&gt;&gt;<\/td><td>D\u1ecbch chuy\u1ec3n c\u00e1c bit c\u1ee7a to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i sang b\u00ean ph\u1ea3i theo gi\u00e1 tr\u1ecb to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i.<\/td><td>a &gt;&gt; 2 \/\/ 001 t\u1ee9c l\u00e0 1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed Bitwise<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program of Bitwise Operations \n#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;])\n{\n    NSAutoreleasePool *pool = &#91;&#91;NSAutoreleasePool alloc] init];\n        \/\/ n1 = 5(00000101), n2 = 9(00001001)\n    int n1 = 5, n2 = 9;\n        \/\/ The result is 00000001\n    NSLog(@\"Bitwise AND(n1&amp;n2) = %d\\n\", (n1&amp;n2));\n        \/\/ The result is 00001101\n    NSLog(@\"Bitwise OR(n1|n2) = %d\\n\", (n1|n2));\n        \/\/ The result is 00010010\n    NSLog(@\"LEFT SHIFT(n2&lt;&lt;2) = %d\\n\", (n2&lt;&lt;2));\n        \/\/ The result is 00000100\n    NSLog(@\"RIGHT SHIFT(n2&gt;&gt;2) = %d\\n\", (n2&gt;&gt;2));\n        \/\/ The result is 00001100\n    NSLog(@\"XOR(n1^n2) = %d\\n\", (n1^n2));\n        \/\/ The result is 11111010\n    NSLog(@\"ONCE COMPLIMENT(~n1) = %d\\n\", (~n1));\n        &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-12-06 16:26:01.001 a.out&#91;1091:1091] Ph\u00e9p to\u00e1n AND theo bit (n1&amp;n2) = 1 \n2022-12-06 16:26:01.005 a.out&#91;1091:1091] Ph\u00e9p to\u00e1n OR theo bit (n1|n2) = 13 \n2022-12-06 16:26:01.005 a.out&#91;1091:1091] PH\u00c9P D\u1ecaCH TR\u00c1I (n2&lt;&lt;2) = 36 \n2022-12-06 16:26:01.005 a.out&#91;1091:1091] PH\u00c9P D\u1ecaCH PH\u1ea2I (n2&gt;&gt;2) = 2 \n2022-12-06 16:26:01.005 a.out&#91;1091:1091] XOR(n1^n2) = 12 \n2022-12-06 16:26:01.005 a.out&#91;1091:1091] M\u1ed8T L\u1ea6N K\u00c8M (~n1) = -6<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed g\u00e1n: <\/strong>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 g\u00e1n gi\u00e1 tr\u1ecb cho m\u1ed9t to\u00e1n h\u1ea1ng\/bi\u1ebfn. Ph\u00eda b\u00ean tr\u00e1i l\u00e0 to\u00e1n h\u1ea1ng v\u00e0 ph\u00eda b\u00ean ph\u1ea3i l\u00e0 gi\u00e1 tr\u1ecb c\u1ee7a to\u00e1n h\u1ea1ng \u0111\u00f3 \u0111\u01b0\u1ee3c g\u00e1n b\u1eb1ng to\u00e1n t\u1eed g\u00e1n (=).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><\/tr><tr><td><strong>=<\/strong><\/td><td>G\u00e1n gi\u00e1 tr\u1ecb t\u1eeb to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>+=<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p c\u1ed9ng to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i v\u00e0o to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i v\u00e0 g\u00e1n k\u1ebft qu\u1ea3 cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>-=<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p tr\u1eeb to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i v\u00e0 g\u00e1n k\u1ebft qu\u1ea3 cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>*=<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p nh\u00e2n to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i v\u1edbi to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i v\u00e0 g\u00e1n k\u1ebft qu\u1ea3 cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>\/=<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p chia to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i cho to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i v\u00e0 g\u00e1n k\u1ebft qu\u1ea3 cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>%=<\/strong><\/td><td>Th\u1ef1c hi\u1ec7n ph\u00e9p chia to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i cho to\u00e1n h\u1ea1ng b\u00ean ph\u1ea3i v\u00e0 g\u00e1n k\u1ebft qu\u1ea3 t\u1ee9c l\u00e0 ph\u1ea7n d\u01b0 cho to\u00e1n h\u1ea1ng b\u00ean tr\u00e1i.<\/td><\/tr><tr><td><strong>&lt;&lt;=<\/strong><\/td><td>To\u00e1n t\u1eed d\u1ecbch chuy\u1ec3n tr\u00e1i v\u00e0 g\u00e1n.<\/td><\/tr><tr><td>&gt;&gt;=<\/td><td>To\u00e1n t\u1eed d\u1ecbch chuy\u1ec3n v\u00e0 g\u00e1n ph\u1ea3i.<\/td><\/tr><tr><td>&amp;=<\/td><td>To\u00e1n t\u1eed g\u00e1n bit AND &amp;.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed g\u00e1n<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program of Assignment Operations\n#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;])\n{\n    NSAutoreleasePool *pool = &#91;&#91;NSAutoreleasePool alloc] init];\n        int n1 = 20;\n    int n2;\n        \/\/ Using assignment operator\n    n2 = n1;\n    NSLog(@\"ASSIGN(=)= %d\\n\", n2);\n        \/\/ Using short hand addition operator\n    \/\/ n1=n1+n2\n    n1 += n2;\n    NSLog(@\"SHORT HAND ADDITION(+=)= %d\\n\", n1);\n        \/\/ Using short hand subtraction operator\n    \/\/ n1=n1-n2\n    n1 -= n2;\n    NSLog(@\"SHORT HAND SUBTRACTION(-=)= %d\\n\", n1);\n        \/\/ Using short hand multiplication operator\n    \/\/ n1=n1*n2\n    n1 *= n2;\n    NSLog(@\"SHORT HAND MULTIPLICATION= %d\\n\", n1);\n        \/\/ Using short hand division operator\n    \/\/ n1=n1\/n2\n    n1 \/= n2;\n    NSLog(@\"SHORT HAND DIVISION(\/=)= %d\\n\", n1);\n        n1 = 100;\n        \/\/ Using short hand mod operator\n    \/\/ n1=n1%n2\n    n1 %= n2;\n    NSLog(@\"n1 MOD n2(%=)= %d\\n\", n1);\n        \/\/ Using short hand bitwise AND operator\n    \/\/ n1=n1&amp;n2\n    n1 &amp;= 2;\n    NSLog(@\"SHORT HAND BITWISE AND(&amp;=)= %d\\n\", n1);\n        \/\/ Using short hand XOR operator\n    \/\/ n1=n1^n2\n    n1 ^= 2;\n    NSLog(@\"SHORT HAND XOR(^=)= %d\\n\", n1);\n        \/\/ Using short hand bitwise OR operator\n    \/\/n1=n1|2\n    n1 |= 2;\n    NSLog(@\"SHORT HAND BITWISE OR(|=)= %d\\n\", n1);\n        \/\/ Using short hand left shift operator\n    \/\/ n1=n1&lt;&lt;2\n    n1 &lt;&lt;= 2;\n    NSLog(@\"SHORT HAND LEFT SHIFT(&lt;&lt;=)= %d\\n\", n1);\n        \/\/ Using short hand right shift operator\n    \/\/ n1=n1&gt;&gt;2\n    n1 &gt;&gt;= 2;\n    NSLog(@\"SHORT HAND RIGHT SHIFT(&gt;&gt;=)= %d\\n\", n1);\n       &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-12-06 16:44:09.028 a.out&#91;4481:4481] ASSIGN(=)= 20\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND ADDITION(+=)= 40\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND SUBTRACTION(-=)= 20\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND MULTIPLICATION= 400\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND DIVISION(\/=)= 20\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] n1 MOD n2(%=)= 0\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND BITWISE ANS(&amp;=)= 0\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND XOR(^=)= 2\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND BITWISE OR(|=)= 2\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND LEFT SHIFT(&lt;&lt;=)= 8\n2022-12-06 16:44:09.031 a.out&#91;4481:4481] SHORT HAND RIGHT SHIFT(&gt;&gt;=)= 2<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>To\u00e1n t\u1eed \u0111\u1eb7c bi\u1ec7t: <\/strong>Do ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh cung c\u1ea5p, \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c hi\u1ec7n m\u1ed9t t\u00e1c v\u1ee5 c\u1ee5 th\u1ec3.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u00e2n lo\u1ea1i<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><strong>Size()<\/strong><\/td><td>To\u00e1n t\u1eed t\u00edch h\u1ee3p tr\u1ea3 v\u1ec1 k\u00edch th\u01b0\u1edbc c\u1ee7a bi\u1ebfn.<\/td><td><code>int a=10; sizeof(a); \/\/ 4byte<\/code><\/td><\/tr><tr><td><strong>&amp;<\/strong><\/td><td>Tr\u1ea3 v\u1ec1 \u0111\u1ecba ch\u1ec9 c\u1ee7a m\u1ed9t bi\u1ebfn.<\/td><td><code>&amp;a \/\/ \u0111\u1ecba ch\u1ec9 c\u1ee7a a s\u1ebd tr\u1ea3 v\u1ec1<\/code><\/td><\/tr><tr><td><strong>*<\/strong><\/td><td>Th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng t\u1ea1o bi\u1ebfn con tr\u1ecf (int *p) \u0111\u1ec3 khai b\u00e1o ki\u1ec3u ho\u1eb7c l\u00e0m to\u00e1n t\u1eed gi\u1ea3i tham chi\u1ebfu (dereference) \u0111\u1ec3 truy c\u1eadp gi\u00e1 tr\u1ecb t\u1ea1i \u0111\u1ecba ch\u1ec9 m\u00e0 con tr\u1ecf tr\u1ecf t\u1edbi (*p).<\/td><td><code>s\u1ed1 nguy\u00ean a=10; s\u1ed1 nguy\u00ean *b = &amp;a;<\/code><\/td><\/tr><tr><td><strong>?:<\/strong><\/td><td>Bi\u1ec3u th\u1ee9c \u0111i\u1ec1u ki\u1ec7n. Thay th\u1ebf cho c\u00e2u l\u1ec7nh if else \u0111\u01a1n gi\u1ea3n.<\/td><td><code>int number1 = 5, number2 = 10, max;\/\/ max = 10max = (number1 > number2) ? number1 : number2;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><em>V\u00ed d\u1ee5 v\u1ec1 to\u00e1n t\u1eed \u0111\u1eb7c bi\u1ec7t<\/em><\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program of Misc (sizeof &amp; ternary) Operations \n\/\/ or special operators\n#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;])\n{\n   NSAutoreleasePool *pool = &#91;&#91;NSAutoreleasePool alloc] init];\n      \/\/ Initialize numbers\n   int num1 = 7;\n   int res = 0;\n      \/\/ Pointer variable\n   int *ptr;\n      \/\/ Printing size of num1 of type int\n   NSLog(@\"Size of num1(int)= %d\\n\", sizeof(num1));\n      \/\/ Assigning address of num1 to the pointer variable ptr \n   ptr = &amp;num1;\n   NSLog(@\"num1 = %d\\n\", num1);\n   NSLog(@\"*ptr = %d\\n\", *ptr);\n   int a = 12;\n      \/\/ Checking condition(a==1) with ternary operator\n   res = (a == 10) ? 1: 0;\n   NSLog(@\"Answer = %d\\n\", res);\n   res = (a == 12) ? 1: 0;\n   NSLog(@\"Answer = %d\\n\", res);\n        &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-12-06 17:05:01.804 a.out&#91;248:248] Size of num1(int)= 4\n2022-12-06 17:05:01.805 a.out&#91;248:248] num1 = 7\n2022-12-06 17:05:01.805 a.out&#91;248:248] *ptr = 7\n2022-12-06 17:05:01.805 a.out&#91;248:248] Answer = 0\n2022-12-06 17:05:01.805 a.out&#91;248:248] Answer = 1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ngay-5-va-6-hoc-ve-cau-lenh-va-vong-lap-objective-c\"><strong>Ng\u00e0y 5 v\u00e0 6: H\u1ecdc v\u1ec1 c\u00e2u l\u1ec7nh v\u00e0 v\u00f2ng l\u1eb7p Objective-C<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"cau-lenh-trong-objective-c\"><strong>C\u00e2u l\u1ec7nh trong Objective-C<\/strong><\/h4>\n\n\n\n<p>Gi\u1ed1ng nh\u01b0 m\u1ecdi ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh, Objective-C c\u0169ng c\u00f3 m\u1ed9t c\u00e2u l\u1ec7nh \u0111i\u1ec1u khi\u1ec3n quy\u1ebft \u0111\u1ecbnh, c\u1ee5 th\u1ec3 l\u00e0 c\u00e2u l\u1ec7nh if-else v\u00e0 c\u00e2u l\u1ec7nh switch. C\u00e1c c\u00e2u l\u1ec7nh n\u00e0y gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean th\u1ef1c hi\u1ec7n m\u1ed9t ho\u1eb7c m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c l\u1ec7nh d\u1ef1a tr\u00ean m\u1ed9t \u0111i\u1ec1u ki\u1ec7n \u0111\u00e3 x\u00e1c \u0111\u1ecbnh.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh If: <\/strong>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ki\u1ec3m tra \u0111i\u1ec1u ki\u1ec7n v\u00e0 \u0111i\u1ec1u h\u01b0\u1edbng lu\u1ed3ng th\u1ef1c thi c\u1ee7a ch\u01b0\u01a1ng tr\u00ecnh d\u1ef1a tr\u00ean k\u1ebft qu\u1ea3 c\u1ee7a \u0111i\u1ec1u ki\u1ec7n \u0111\u00f3.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( defined_condition )\n{\nstatement_1;\nstatement_2;\nstatement_3;\n\/\/ if the defined_condition become true, \n\/\/statement 1,2,3 will execute, \n}\n\/\/ if defined_condition evaluates false, \n\/\/ compiler will simply ignore those statements.<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate\n\/\/ the use of IF statement.\n#import &lt;Foundation\/Foundation.h&gt;\n\nint main() {\n  \/\/ Kh\u1ed1i @autoreleasepool qu\u1ea3n l\u00fd c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng t\u1ef1 gi\u1ea3i ph\u00f3ng trong ph\u1ea1m vi c\u1ee7a\n  \/\/ n\u00f3. ARC s\u1ebd t\u1ef1 \u0111\u1ed9ng x\u1eed l\u00fd vi\u1ec7c n\u00e0y.\n  @autoreleasepool {\n    \/\/ Declaration and Initialization of number.\n    int number = 8;\n\n    \/\/ Checking if the number less then 10.\n    if (number &lt; 10) {\n      \/\/ Number is less then 10,\n      \/\/ means condition evaluates true.\n      NSLog(@\"Number %d is less then 10\", number);\n    }\n    NSLog(@\"Value of number is %d\", number);\n  }  \/\/ K\u1ebft th\u00fac kh\u1ed1i @autoreleasepool, c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng t\u1ea1m th\u1eddi s\u1ebd \u0111\u01b0\u1ee3c gi\u1ea3i\n     \/\/ ph\u00f3ng.\n  return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3:<\/strong> Number 8 is less then 10. Value of number is 8.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh If-Else: <\/strong>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c thi kh\u1ed1i l\u1ec7nh trong if n\u1ebfu \u0111i\u1ec1u ki\u1ec7n \u0111\u00fang v\u00e0 ng\u01b0\u1ee3c l\u1ea1i, th\u1ef1c thi kh\u1ed1i l\u1ec7nh trong else n\u1ebfu \u0111i\u1ec1u ki\u1ec7n sai.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( defined_condition )\n{\nstatement_1;\nstatement_2;\nstatement_3;\n\/\/ if the defined_condition become true, \n\/\/ statement 1,2,3 will execute, \n}\nelse\n{\nstatement_4;\nstatement_5;\n\/\/ if the defined_condition become false, \n\/\/ statement 4,5 will execute, \n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate\n\/\/ the use of IF-ELSE statement.\n#import &lt;Foundation\/Foundation.h&gt;\nint main () \n{\n    NSAutoreleasePool *myPool = &#91;&#91;NSAutoreleasePool alloc] init];\n        \/\/ Declaration and Initialization of number. \n    int number = 8;\n          \/\/ Checking, is the number less then 10. \n    if( number % 2 == 0)\n    {    \n          \/\/ number % 2 is equal to 0 \n          \/\/ so, condition evaluates true.\n        NSLog(@\"---&gt; %d is a Even number.\\n\", number);\n    }\n    else\n    {\n          \/\/ number % 2 is not equal to 0 \n          \/\/ so, condition evaluates false.\n        NSLog(@\"---&gt; %d is a Odd number.\\n\", number);\n    }\n      return 0;\n      &#91;myPool drain];\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3<\/strong>: &#8212;&gt; 8 is a Even number<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh Nested if-else (if-else l\u1ed3ng nhau):<\/strong> C\u1ea5u tr\u00fac n\u00e0y g\u1ed3m m\u1ed9t c\u00e2u l\u1ec7nh if ho\u1eb7c else ch\u1ee9a th\u00eam c\u00e1c c\u00e2u l\u1ec7nh \u0111i\u1ec1u ki\u1ec7n if-else kh\u00e1c b\u00ean trong. Ki\u1ec3u c\u00e2u l\u1ec7nh n\u00e0y \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c logic r\u1ebd nh\u00e1nh nhi\u1ec1u t\u1ea7ng, x\u1eed l\u00fd c\u00e1c \u0111i\u1ec1u ki\u1ec7n ph\u1ee9c t\u1ea1p t\u00f9y theo tr\u01b0\u1eddng h\u1ee3p c\u1ee5 th\u1ec3.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( defined_condition )\n{\nif(inner_Condition)\n{\n\/\/\/ if defined_Condition and inner_condition \n\/\/\/ both evaluates as true, then and only then\n\/\/\/ statement_1 will be execute.\nstatement_1;\n}\nelse\n{\n\/\/\/ if defined_Condition evaluates as true but\n\/\/\/ inner_condition evaluates as false, then and only then\n\/\/\/ statement_2 will be execute.\nstatement_2;\n}\n}\nelse\n{\n\/\/\/ if the defined_condition become false, \n\/\/\/statement3 will execute, \nstatement_3;\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate\n\/\/ the use of Nested IF-ELSE statement.\n#import &lt;Foundation\/Foundation.h&gt;\nint main () \n{\n    NSAutoreleasePool *myPool = &#91;&#91;NSAutoreleasePool alloc] init];\n Declaration and Initialization of number. \n    int num_1 = 8;\n    int num_2 = 2;\n          \/\/ Checking, is the number less then 10. \n    if ( num_1 % 2 == 0)\n    {\n        \/\/ If num_1 is an even number\n        if (num_2 % 2 == 0)\n        {\n            \/\/ If num_2 is also an even number.\n            NSLog(@\"%d and %d both are Even number.\\n\", num_1, num_2);\n        }\n        else\n        {\n            \/\/ If num_1 is even but num_2 is odd\n            NSLog(@\"%d is Even number and\\n\", num_1);\n            NSLog(@\"%d is an Odd number.\\n\", num_2);\n        }\n    }\n    else\n    {\n        \/\/ If num_1 and num_2 both are Odd number\n        NSLog(@\"%d and %d both are Odd number.\\n\", num_1, num_2);\n    }\n      return 0;\n      &#91;myPool drain];\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3<\/strong>: 8 and 2 both are Even number.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh if-else if-else:<\/strong> L\u00e0 m\u1ed9t chu\u1ed7i c\u00e1c \u0111i\u1ec1u ki\u1ec7n \u0111\u01b0\u1ee3c ki\u1ec3m tra tu\u1ea7n t\u1ef1. N\u1ebfu if \u0111\u1ea7u ti\u00ean sai, ki\u1ec3m tra else if th\u1ee9 nh\u1ea5t. N\u1ebfu k\u1ebft qu\u1ea3 l\u00e0 sai, ti\u1ebfp t\u1ee5c ki\u1ec3m tra else if ti\u1ebfp theo (n\u1ebfu c\u00f3). N\u1ebfu t\u1ea5t c\u1ea3 c\u00e1c \u0111i\u1ec1u ki\u1ec7n tr\u01b0\u1edbc \u0111\u00f3 \u0111\u1ec1u sai, kh\u1ed1i else cu\u1ed1i c\u00f9ng s\u1ebd \u0111\u01b0\u1ee3c th\u1ef1c thi.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( defined_condition_A )\n{\nstatement_1;\nstatement_2;\nstatement_3;\n\/\/ if the defined_condition_A become true, \n\/\/statement 1,2,3 will execute, \n}\nelse if (defined_condition_B )\n{\nstatement_4;\nstatement_5;\n\/\/ if the defined_condition_B become true, \n\/\/statement 4,5 will execute, \n}\nelse\n{\nstatement_6;\n\/\/ if the defined_condition_A as well as\n\/\/ defined_condition_B both become false, \n\/\/statement 6 will execute, \n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to illustrate\n\/\/ the use of IF-ELSEIF-ELSE statement.\n#import &lt;Foundation\/Foundation.h&gt;\n\nint main () \n{\n    NSAutoreleasePool *myPool = &#91;&#91;NSAutoreleasePool alloc] init];\n    \n    \/\/ Declaration and Initialization of number. \n    int number = 10;\n    \n      \/\/ Checking, is the number less then 10. \n    if (number &gt; 0)\n    {\n          \/\/ number &gt; 0, so \n          \/\/condition evaluates true.\n        NSLog(@\"---&gt; %d is a Positive number.\\n\", number);\n    }\n    else if (number &lt; 0)\n    {\n          \/\/ number &lt; 0, so \n          \/\/ condition evaluates true.\n        NSLog(@\"---&gt; %d is a Negative number.\\n\", number);\n    }\n      else\n    {\n        \/\/ Both the above condition evaluates false.\n          \/\/ which means number is equal to 0.\n        NSLog(@\"---&gt; Value of number is %d\\n\", number);\n    }\n    \n      return 0;\n      &#91;myPool drain];\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3<\/strong>: &#8212;&gt; 10 is a Positive number.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh Switch: <\/strong>\u0110\u00e2y l\u00e0 m\u1ed9t c\u1ea5u tr\u00fac \u0111i\u1ec1u khi\u1ec3n, cho ph\u00e9p ki\u1ec3m tra gi\u00e1 tr\u1ecb c\u1ee7a m\u1ed9t bi\u1ec3u th\u1ee9c v\u00e0 th\u1ef1c thi c\u00e1c kh\u1ed1i m\u00e3 t\u01b0\u01a1ng \u1ee9ng v\u1edbi t\u1eebng tr\u01b0\u1eddng h\u1ee3p c\u1ee5 th\u1ec3. C\u00e2u l\u1ec7nh Switch th\u01b0\u1eddng \u0111\u01b0\u1ee3c thay th\u1ebf cho chu\u1ed7i l\u1ec7nh if-else-if d\u00e0i d\u00f2ng, \u0111\u1ec3 m\u00e3 ngu\u1ed3n g\u1ecdn g\u00e0ng v\u00e0 d\u1ec5 \u0111\u1ecdc h\u01a1n.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>switch (expression)\n{\n         case value1: \/\/ statement sequence\n         break;\n         case value2: \/\/ statement sequence\n         break;\n         .\n         .\n         .\n         case valueN: \/\/ statement sequence\n         break;\n         default: \/\/ default statement sequence\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Using Switch case\nusing System;\npublic class Geeks \n{\n\tpublic static void Main(String&#91;] args)\n\t{\n\t\tint number = 30;\n      \t\/\/ Using Switch case \n\t\tswitch(number)\n\t\t{\n\t\t\tcase 10: \n            \tConsole.WriteLine(\"case 10\");\n\t\t\t\tbreak;\n\t\t\tcase 20: \n            \tConsole.WriteLine(\"case 20\");\n\t\t\t\tbreak;\n\t\t\tcase 30: \n            \tConsole.WriteLine(\"case 30\");\n\t\t\t\tbreak;\n\t\t\tdefault: \n            \tConsole.WriteLine(\"None matches\"); \n\t\t\t\tbreak;\n\t\t}\n\t}\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3: <\/strong>Case 30<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u00e2u l\u1ec7nh Switch l\u1ed3ng nhau (Nested Switch): <\/strong>\u0110\u1eb7t m\u1ed9t c\u00e2u l\u1ec7nh switch b\u00ean trong m\u1ed9t case c\u1ee7a c\u00e2u l\u1ec7nh switch kh\u00e1c.<\/li>\n<\/ul>\n\n\n\n<p><strong>C\u00fa ph\u00e1p<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>switch(logical_expression)\n{\n   case constant_1 :\n    \/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n      statement_1;\n      statement_2;\n      break; \n    case constant_2 :\n      statement;\n      break; \n    default : \n      statement_l;\n}\n      break; \n   case constant_2 :\n      \/\/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n      statement_1;\n      statement_2;\n      break; \n    case constant_2 :\n      statement;\n      break; \n    default : \n      statement_p;\n}\n      break;\n   case constant_3 :\n      statement;\n      break; \n   case constant_4 :\n      statement;\n      break; \n   default : \n  statement_k;\n      \/\/\/ You can make switch case inside this\/defaults section also.\n}\nswitch(logical_expression)\n{\n   case constant_1 :\n    \/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n      statement_1;\n      statement_2;\n      break; \n    case constant_2 :\n      statement;\n      break; \n    default : \n      statement_l;\n}\n      break; \n   case constant_2 :\n      \/\/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n      statement_1;\n      statement_2;\n      break; \n   case constant_2 :\n      statement;\n      break; \n    default : \n      statement_p;\n}\n      break;\n   case constant_3 :\n      statement;\n      break; \n   case constant_4 :\n   statement;\n     break; \n   default : \n      statement_k;\n      \/\/\/ You can make switch case inside this\/defaults section also.\n}\nswitch(logical_expression)\n{\n   case constant_1 :\n    \/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n   statement_1;\n    statement_2;\n      break; \n    case constant_2 :\n      statement;\n      break; \n    default : \n      statement_l;\n}\n      break; \n   case constant_2 :\n      \/\/\/ inner switch case \n      switch( logical_expression )\n{\n    case constant_1 :\n      statement_1;\n      statement_2;\n      break;    \n    case constant_2 :\n      statement;\n      break; \n    default : \n      statement_p;\n}\n      break;\n case constant_3 :\n    statement;\n      break; \n   case constant_4 :\n  statement;\n      break; \ndefault : \n      statement_k;\n      \/\/\/ You can make switch case inside this\/defaults section also.\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u200b\u200b\/\/ Objective-C program of nested switch-case statements\n#import &lt;Foundation\/Foundation.h&gt;\nint main () \n{\n    NSAutoreleasePool *myPool = &#91;&#91;NSAutoreleasePool alloc] init];\n    int a = 1, b = 2;\n    \/\/ Outer switch-case\n    switch(a) \n    {\n        \/\/ if a == 1\n        case 1:\n            \/\/ Nested switch-case \/ inner switch-case\n            switch (b) \n            {\n                \/\/ if b == 2\n                case 2:\n                    NSLog(@\"Your choice is 2.\\n\");\n                    break;\n                \/\/ if b == 3\n                case 3:\n                    NSLog(@\"Your choice is 3.\\n\");\n                    break;\n            }\n            break;\n        \/\/ if a == 4\n        case 4:\n            NSLog(@\"Your choice is 4.\\n\");\n            break;\n        \/\/ if a == 5\n        case 5:\n            NSLog(@\"Your choice is 5.\\n\");\n            break;\n        default:\n            NSLog(@\"Your choice is other than 1, 2 3, 4, 5.\\n\");\n            break;\n    }\n      return 0;\n      &#91;myPool drain];\n}<\/code><\/pre>\n\n\n\n<p><strong>K\u1ebft qu\u1ea3<\/strong><strong>:&nbsp;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcty0vOz7ZepmoPNyInHGKdNR21YM-RJm0cADp9OAIiqFkDlOmroAVcsXUNS2VGsBaPWNO62-lFnLDMGLRtpbEeDD00enaPCO56iJNcBvTE7F6en3n6BMTW0wfWGfnJoRqoSeDj?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"vong-lap-trong-objective-c\"><strong>V\u00f2ng l\u1eb7p trong Objective-C<\/strong><\/h4>\n\n\n\n<p>Trong Objective-C, v\u00f2ng l\u1eb7p l\u00e0 c\u1ea5u tr\u00fac \u0111i\u1ec1u khi\u1ec3n cho ph\u00e9p th\u1ef1c thi m\u1ed9t \u0111o\u1ea1n m\u00e3 nhi\u1ec1u l\u1ea7n, t\u00f9y thu\u1ed9c v\u00e0o \u0111i\u1ec1u ki\u1ec7n nh\u1ea5t \u0111\u1ecbnh. C\u00e1c lo\u1ea1i v\u00f2ng l\u1eb7p th\u01b0\u1eddng \u0111\u01b0\u1ee3c d\u00f9ng ph\u1ed5 bi\u1ebfn trong Objective-C g\u1ed3m:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>V\u00f2ng l\u1eb7p<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><\/tr><tr><td><strong>while<\/strong><\/td><td>Ki\u1ec3m tra \u0111i\u1ec1u ki\u1ec7n tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n kh\u1ed1i l\u1ec7nh. N\u1ebfu \u0111i\u1ec1u ki\u1ec7n \u0111\u00fang, kh\u1ed1i l\u1ec7nh s\u1ebd \u0111\u01b0\u1ee3c th\u1ef1c thi; qu\u00e1 tr\u00ecnh n\u00e0y l\u1eb7p l\u1ea1i cho \u0111\u1ebfn khi \u0111i\u1ec1u ki\u1ec7n sai.<\/td><\/tr><tr><td><strong>for<\/strong><\/td><td>Th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng khi bi\u1ebft tr\u01b0\u1edbc s\u1ed1 l\u1ea7n l\u1eb7p, bao g\u1ed3m ph\u1ea7n kh\u1edfi t\u1ea1o, \u0111i\u1ec1u ki\u1ec7n v\u00e0 bi\u1ec3u th\u1ee9c c\u1eadp nh\u1eadt.<\/td><\/tr><tr><td><strong>do&#8230;while<\/strong><\/td><td>\u0110\u1ea3m b\u1ea3o kh\u1ed1i l\u1ec7nh \u0111\u01b0\u1ee3c th\u1ef1c thi \u00edt nh\u1ea5t m\u1ed9t l\u1ea7n tr\u01b0\u1edbc khi ki\u1ec3m tra \u0111i\u1ec1u ki\u1ec7n.<\/td><\/tr><tr><td><strong>V\u00f2ng l\u1eb7p l\u1ed3ng nhau<\/strong><\/td><td>Objective-C cho ph\u00e9p s\u1eed d\u1ee5ng v\u00f2ng l\u1eb7p b\u00ean trong v\u00f2ng l\u1eb7p kh\u00e1c, g\u1ecdi l\u00e0 v\u00f2ng l\u1eb7p l\u1ed3ng nhau.<\/td><\/tr><tr><td><strong>V\u00f2ng l\u1eb7p v\u00f4 h\u1ea1n<\/strong><\/td><td>X\u1ea3y ra khi \u0111i\u1ec1u ki\u1ec7n l\u1eb7p lu\u00f4n \u0111\u00fang. Trong Objective-C, c\u00f3 th\u1ec3 t\u1ea1o v\u00f2ng l\u1eb7p v\u00f4 h\u1ea1n b\u1eb1ng c\u00e1ch b\u1ecf qua \u0111i\u1ec1u ki\u1ec7n trong v\u00f2ng l\u1eb7p for.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ngay-7-hoc-cac-ham-trong-objective-c\"><strong>Ng\u00e0y 7: H\u1ecdc c\u00e1c h\u00e0m trong Objective-C<\/strong><\/h3>\n\n\n\n<p>H\u00e0m l\u00e0 m\u1ed9t kh\u1ed1i m\u00e3 c\u00f3 t\u00ean, th\u1ef1c hi\u1ec7n m\u1ed9t nhi\u1ec7m v\u1ee5 c\u1ee5 th\u1ec3, c\u00f3 th\u1ec3 nh\u1eadn tham s\u1ed1 v\u00e0 tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb. H\u00e0m gi\u00fap t\u1ed5 ch\u1ee9c m\u00e3 ngu\u1ed3n, tr\u00e1nh l\u1eb7p l\u1ea1i v\u00e0 t\u0103ng t\u00ednh t\u00e1i s\u1eed d\u1ee5ng. V\u1edbi h\u00e0m trong Objective-C, b\u1ea1n c\u1ea7n n\u1eafm c\u00e1c ki\u1ebfn th\u1ee9c sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0110\u1ecbnh ngh\u0129a h\u00e0m<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Bao g\u1ed3m hai ph\u1ea7n l\u00e0 ti\u00eau \u0111\u1ec1 h\u00e0m v\u00e0 th\u00e2n h\u00e0m. Ti\u00eau \u0111\u1ec1 h\u00e0m ch\u1ec9 \u0111\u1ecbnh t\u00ean, ki\u1ec3u tr\u1ea3 v\u1ec1 v\u00e0 tham s\u1ed1 c\u1ee7a h\u00e0m. C\u00f2n l\u1ea1i, th\u00e2n h\u00e0m ch\u1ee9a m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c c\u00e2u l\u1ec7nh x\u00e1c \u0111\u1ecbnh ch\u1ee9c n\u0103ng c\u1ee7a h\u00e0m. C\u00fa ph\u00e1p:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>return_type function_name(parameter_list)\n{\n    \/\/ body of the function\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> \u0110\u1ecbnh ngh\u0129a m\u1ed9t h\u00e0m c\u00f3 t\u00ean l\u00e0 max, h\u00e0m n\u00e0y l\u1ea5y hai s\u1ed1 nguy\u00ean l\u00e0m tham s\u1ed1 v\u00e0 tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb l\u1edbn nh\u1ea5t gi\u1eefa ch\u00fang.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int max(int num1, int num2)\n{\n    int result;\n    if (num1 &gt; num2)\n    {\n        result = num1;\n    }\n    else\n    {\n        result = num2;\n    }\n    return result;\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>G\u1ecdi m\u1ed9t h\u00e0m&nbsp;<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u0110\u1ec3 g\u1ecdi m\u1ed9t h\u00e0m, b\u1ea1n ch\u1ec9 c\u1ea7n g\u1ecdi t\u00ean v\u00e0 \u0111\u1ed1i s\u1ed1 ph\u00f9 h\u1ee3p. V\u00ed d\u1ee5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int a = 10;\nint b = 20;\nint c = max(a, b); \/\/ c s\u1ebd nh\u1eadn gi\u00e1 tr\u1ecb 20<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Truy\u1ec1n tham s\u1ed1: <\/strong>C\u00f3 hai c\u00e1ch truy\u1ec1n \u0111\u1ed1i s\u1ed1 cho m\u1ed9t h\u00e0m l\u00e0 truy\u1ec1n theo gi\u00e1 tr\u1ecb ho\u1eb7c truy\u1ec1n theo tham chi\u1ebfu.<\/li>\n<\/ul>\n\n\n\n<p><em><strong>Truy\u1ec1n theo gi\u00e1 tr\u1ecb (pass by value)<\/strong>: Truy\u1ec1n b\u1ea3n sao c\u1ee7a gi\u00e1 tr\u1ecb; thay \u0111\u1ed5i trong h\u00e0m kh\u00f4ng \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn bi\u1ebfn g\u1ed1c.<\/em><\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> \u0110o\u1ea1n m\u00e3 sau \u0111\u1ecbnh ngh\u0129a v\u00e0 g\u1ecdi m\u1ed9t h\u00e0m c\u00f3 t\u00ean l\u00e0 square tr\u1ea3 v\u1ec1 b\u00ecnh ph\u01b0\u01a1ng c\u1ee7a m\u1ed9t s\u1ed1 nguy\u00ean.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Auther: Nikunj Sonigara\n#include &lt;stdio.h&gt;\n\/\/ Function declaration\nint square(int x);\n\/\/ Function definition\nint square(int x)\n{\n    return x * x; \/\/ return the square of x\n}\nint main()\n{\n    \/\/ Function call\n    int a = 5;\n    int b = square(a);\n    printf(\"The square of %d is %d\\n\", a, b);\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfGilW191Ze_PgQ6tzAFPwyVY4bnQXjs1rZs9Cb9uQt34fwiIrK1ISFGVmzt2YHsHAJEk3buNHryVPk2MAJYA5WWIlBfyUgLLQf7zihyh5IcVPs-caYGqwglifH8mRig371MhRnew?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<p><em><strong>Truy\u1ec1n theo tham chi\u1ebfu (pass by reference)<\/strong>: Truy\u1ec1n \u0111\u1ecba ch\u1ec9 c\u1ee7a bi\u1ebfn; thay \u0111\u1ed5i trong h\u00e0m \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn bi\u1ebfn g\u1ed1c.<\/em><\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong>: \u0110o\u1ea1n m\u00e3 sau \u0111\u1ecbnh ngh\u0129a v\u00e0 g\u1ecdi m\u1ed9t h\u00e0m c\u00f3 t\u00ean l\u00e0 swap \u0111\u1ec3 ho\u00e1n \u0111\u1ed5i hai s\u1ed1 nguy\u00ean b\u1eb1ng c\u00e1ch truy\u1ec1n ch\u00fang theo tham chi\u1ebfu.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to pass arguments\n\/\/ and return values\n#include &lt;stdio.h&gt;\n\/\/ Function declaration\nvoid swap(int *x, int *y);\n\/\/ Function definition\nvoid swap(int *x, int *y)\n{\n  int temp;  \n  \/\/ temp gets the value pointed by x\n  temp = *x; \n  \/\/ x gets the value pointed by y \n  *x = *y;   \n  \/\/ y gets the value stored in temp\n  *y = temp; \n}\n\/\/ Driver code\nint main()\n{\n  \/\/ Function call\n  int a = 10;\n  int b = 20;\n  printf(\"Before swap: a = %d, b = %d\\n\", a, b);\n  swap(&amp;a, &amp;b);\n  printf(\"After swap: a = %d, b = %d\\n\", a, b);\n  return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXf-J8l2RXw7kT5n1cKS8jhXJjl1WlCSi_gq99-iBb8hzceaIKOowoJ_kgqJX2Y0l29sBUCRdhKTdc0VrU6YvXrqpM3l8R9o505KQgwj_q7g-oCt1pr6sYu4PdXvhjacCWdzNKi5Og?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ngay-8-va-9-tim-hieu-lap-trinh-huong-doi-tuong-oop-co-ban\"><strong>Ng\u00e0y 8 v\u00e0 9: T\u00ecm hi\u1ec3u l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng (OOP) c\u01a1 b\u1ea3n<\/strong><\/h3>\n\n\n\n<p>Objective-C l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng (OOP). OOP c\u00f3 4 t\u00ednh ch\u1ea5t quan tr\u1ecdng g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>T\u00ednh \u0111\u00f3ng g\u00f3i (Encapsulation): <\/strong>\u0110\u00e2y l\u00e0 vi\u1ec7c gi\u1ea5u th\u00f4ng tin b\u00ean trong \u0111\u1ed1i t\u01b0\u1ee3ng v\u00e0 ch\u1ec9 c\u00f3 th\u1ec3 truy c\u1eadp th\u00f4ng qua ph\u01b0\u01a1ng th\u1ee9c c\u00f4ng khai.&nbsp;<\/li>\n\n\n\n<li><strong>T\u00ednh k\u1ebf th\u1eeba (Inheritance): <\/strong>T\u00ednh ch\u1ea5t n\u00e0y cho ph\u00e9p l\u1edbp con k\u1ebf th\u1eeba c\u00e1c thu\u1ed9c t\u00ednh v\u00e0 ph\u01b0\u01a1ng th\u1ee9c t\u1eeb l\u1edbp cha, gi\u00fap t\u00e1i s\u1eed d\u1ee5ng m\u00e3 v\u00e0 m\u1edf r\u1ed9ng d\u1ec5 d\u00e0ng.<\/li>\n\n\n\n<li><strong>T\u00ednh \u0111a h\u00ecnh (Polymorphism): <\/strong>T\u00ednh ch\u1ea5t n\u00e0y cho ph\u00e9p \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 nhi\u1ec1u h\u00ecnh th\u00e1i kh\u00e1c nhau, c\u00f3 ngh\u0129a l\u00e0 d\u00f9 c\u00f9ng m\u1ed9t ph\u01b0\u01a1ng th\u1ee9c nh\u01b0ng \u1edf c\u00e1c l\u1edbp kh\u00e1c nhau khi ho\u1ea1t \u0111\u1ed9ng c\u1ee7a n\u00f3 c\u0169ng kh\u00e1c nhau.<\/li>\n\n\n\n<li><strong>T\u00ednh tr\u1eebu t\u01b0\u1ee3ng (Abstraction): <\/strong>T\u00ednh ch\u1ea5t n\u00e0y cho ph\u00e9p \u1ea9n \u0111i nh\u1eefng chi ti\u1ebft ph\u1ee9c t\u1ea1p v\u00e0 ch\u1ec9 cung c\u1ea5p nh\u1eefng g\u00ec c\u1ea7n thi\u1ebft cho ng\u01b0\u1eddi d\u00f9ng.<\/li>\n<\/ul>\n\n\n\n<p>Trong l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng, c\u00e1c l\u1edbp (classes) v\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng (objects) l\u00e0 nh\u1eefng th\u00e0nh ph\u1ea7n c\u01a1 b\u1ea3n nh\u1ea5t.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"lop\"><strong>L\u1edbp<\/strong><\/h4>\n\n\n\n<p>L\u00e0 m\u1ed9t b\u1ea3n thi\u1ebft k\u1ebf ho\u1eb7c khu\u00f4n m\u1eabu \u0111\u1ecbnh ngh\u0129a c\u00e1c thu\u1ed9c t\u00ednh v\u00e0 h\u00e0nh vi c\u1ee7a c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng. Trong Objective-C, l\u1edbp \u0111\u01b0\u1ee3c khai b\u00e1o b\u1eb1ng t\u1eeb kh\u00f3a @interface v\u00e0 \u0111\u01b0\u1ee3c tri\u1ec3n khai b\u1eb1ng t\u1eeb kh\u00f3a @implementation.<\/p>\n\n\n\n<p><strong>C\u00fa ph\u00e1p khai b\u00e1o<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@interface ClassName : SuperClassName\n{\n    \/\/ Khai b\u00e1o bi\u1ebfn th\u00e0nh vi\u00ean\n}\n\/\/ Khai b\u00e1o thu\u1ed9c t\u00ednh\n\/\/ Khai b\u00e1o ph\u01b0\u01a1ng th\u1ee9c\n@end<\/code><\/pre>\n\n\n\n<p><strong>C\u00fa ph\u00e1p tri\u1ec3n khai<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@implementation ClassName\n\/\/ Tri\u1ec3n khai ph\u01b0\u01a1ng th\u1ee9c\n@end<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ClassName<\/code>: T\u00ean c\u1ee7a l\u1edbp.<\/li>\n\n\n\n<li><code>SuperClassName<\/code>: T\u00ean c\u1ee7a l\u1edbp cha m\u00e0 l\u1edbp hi\u1ec7n t\u1ea1i k\u1ebf th\u1eeba. N\u1ebfu kh\u00f4ng k\u1ebf th\u1eeba l\u1edbp n\u00e0o, m\u1eb7c \u0111\u1ecbnh l\u00e0 NSObject.<\/li>\n<\/ul>\n\n\n\n<p>C\u00e1c lo\u1ea1i l\u1edbp th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong Objective-C g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Abstract Class: <\/strong>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng l\u00e0m l\u1edbp c\u01a1 s\u1edf cho c\u00e1c l\u1edbp kh\u00e1c v\u00e0 cung c\u1ea5p m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c ph\u01b0\u01a1ng th\u1ee9c v\u00e0 thu\u1ed9c t\u00ednh chung cho t\u1ea5t c\u1ea3 c\u00e1c l\u1edbp k\u1ebf th\u1eeba t\u1eeb l\u1edbp n\u00e0y. Trong Objective-C, l\u1edbp tr\u1eebu t\u01b0\u1ee3ng \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a b\u1eb1ng t\u1eeb kh\u00f3a @interface v\u1edbi m\u1ed9t ph\u01b0\u01a1ng th\u1ee9c kh\u00f4ng c\u00f3 tri\u1ec3n khai.<\/li>\n\n\n\n<li><strong>Concrete Class: <\/strong>Cung c\u1ea5p m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c ph\u01b0\u01a1ng th\u1ee9c v\u00e0 thu\u1ed9c t\u00ednh d\u00e0nh ri\u00eang cho l\u1edbp \u0111\u00f3. Trong Objective-C, m\u1ed9t l\u1edbp c\u1ee5 th\u1ec3 \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a b\u1eb1ng t\u1eeb kh\u00f3a @interface v\u1edbi danh s\u00e1ch c\u00e1c bi\u1ebfn th\u1ec3 hi\u1ec7n, thu\u1ed9c t\u00ednh v\u00e0 ph\u01b0\u01a1ng th\u1ee9c.<\/li>\n\n\n\n<li><strong>Root Class: <\/strong>L\u00e0 l\u1edbp kh\u00f4ng k\u1ebf th\u1eeba t\u1eeb b\u1ea5t k\u1ef3 l\u1edbp n\u00e0o kh\u00e1c. Trong Objective-C, l\u1edbp g\u1ed1c l\u00e0 NSObject, cung c\u1ea5p m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c ph\u01b0\u01a1ng th\u1ee9c v\u00e0 thu\u1ed9c t\u00ednh chung cho t\u1ea5t c\u1ea3 c\u00e1c l\u1edbp trong Objective-C.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"doi-tuong-object\"><strong>\u0110\u1ed1i t\u01b0\u1ee3ng (Object)<\/strong><\/h4>\n\n\n\n<p>\u0110\u1ed1i t\u01b0\u1ee3ng l\u00e0 m\u1ed9t th\u1ec3 hi\u1ec7n c\u1ee5 th\u1ec3 c\u1ee7a m\u1ed9t l\u1edbp. \u0110\u1ec3 t\u1ea1o m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng, b\u1ea1n c\u1ea7n c\u1ea5p ph\u00e1t b\u1ed9 nh\u1edb v\u00e0 kh\u1edfi t\u1ea1o n\u00f3. Trong Objective-C c\u00f3 c\u00e1c lo\u1ea1i \u0111\u1ed1i t\u01b0\u1ee3ng sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0110\u1ed1i t\u01b0\u1ee3ng c\u00f3 th\u1ec3 thay \u0111\u1ed5i:<\/strong> L\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 gi\u00e1 tr\u1ecb c\u00f3 th\u1ec3 thay \u0111\u1ed5i sau khi \u0111\u01b0\u1ee3c t\u1ea1o. Trong Objective-C, \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 th\u1ec3 thay \u0111\u1ed5i th\u01b0\u1eddng \u0111\u01b0\u1ee3c t\u1ea1o b\u1eb1ng ti\u1ec1n t\u1ed1 NSMutable nh\u01b0 NSMutableString, NSMutableArray v\u00e0 NSMutableDictionary.<\/li>\n\n\n\n<li><strong>\u0110\u1ed1i t\u01b0\u1ee3ng b\u1ea5t bi\u1ebfn: <\/strong>L\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 gi\u00e1 tr\u1ecb kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i sau khi \u0111\u01b0\u1ee3c t\u1ea1o. Trong Objective-C, \u0111\u1ed1i t\u01b0\u1ee3ng b\u1ea5t bi\u1ebfn th\u01b0\u1eddng \u0111\u01b0\u1ee3c t\u1ea1o b\u1eb1ng ti\u1ec1n t\u1ed1 NS nh\u01b0 NSString, NSArray v\u00e0 NSDictionary.<\/li>\n\n\n\n<li><strong>\u0110\u1ed1i t\u01b0\u1ee3ng Singleton:<\/strong> L\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng ch\u1ec9 \u0111\u01b0\u1ee3c kh\u1edfi t\u1ea1o m\u1ed9t l\u1ea7n trong su\u1ed1t v\u00f2ng \u0111\u1eddi c\u1ee7a \u1ee9ng d\u1ee5ng. Trong Objective-C, m\u1eabu singleton th\u01b0\u1eddng \u0111\u01b0\u1ee3c tri\u1ec3n khai b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng bi\u1ebfn t\u0129nh v\u00e0 ph\u01b0\u01a1ng th\u1ee9c l\u1edbp tr\u1ea3 v\u1ec1 th\u1ec3 hi\u1ec7n singleton.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ngay-10-va-11-hoc-ve-mang-chuoi-va-xu-ly-du-lieu\"><strong>Ng\u00e0y 10 v\u00e0 11: H\u1ecdc v\u1ec1 m\u1ea3ng, chu\u1ed7i v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"mang-trong-objective-c-la-gi\"><strong>M\u1ea3ng trong Objective-C l\u00e0 g\u00ec?<\/strong><\/h4>\n\n\n\n<p>Trong Objective-C, m\u1ea3ng l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng d\u00f9ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u ph\u1ea7n t\u1eed c\u00f9ng l\u00fac. Kh\u00e1c v\u1edbi m\u1ea3ng nguy\u00ean thu\u1ef7, Objective-C s\u1eed d\u1ee5ng hai l\u1edbp \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi m\u1ea3ng: NSArray v\u00e0 NSMutableArray.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>NSArray l\u00e0 m\u1ea3ng b\u1ea5t bi\u1ebfn, c\u00f3 ngh\u0129a l\u00e0 sau khi \u0111\u01b0\u1ee3c kh\u1edfi t\u1ea1o, b\u1ea1n kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i n\u1ed9i dung c\u1ee7a n\u00f3.<\/li>\n\n\n\n<li>NSMutableArray l\u00e0 m\u1ea3ng c\u00f3 th\u1ec3 thay \u0111\u1ed5i, cho ph\u00e9p b\u1ea1n thay \u0111\u1ed5i c\u00e1c ph\u1ea7n t\u1eed sau khi m\u1ea3ng \u0111\u01b0\u1ee3c t\u1ea1o.<\/li>\n<\/ul>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc6gO5gmyY93RzExcqy0SXE1tzp07OaU7iKG1r8C3eMsQ8TsEsLUzU5fLRS8KDiDtO3iUA6-2D3L8nhL4LjmQ8bHDshJbk-bG1LXMnxAiETYWELtjxB2R02oP7NLaWgTvPDk8U2Hg?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u0110\u1ec3 khai b\u00e1o m\u1ed9t m\u1ea3ng, b\u1ea1n c\u1ea7n ch\u1ec9 \u0111\u1ecbnh ki\u1ec3u m\u1ea3ng c\u00f9ng v\u1edbi t\u00ean v\u00e0 k\u00edch th\u01b0\u1edbc c\u1ee7a m\u1ea3ng theo c\u00fa ph\u00e1p:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type arr&#91;size-of-array]; v\u00ed d\u1ee5: int arr&#91;5];<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Kh\u1edfi t\u1ea1o m\u1ed9t m\u1ea3ng<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Trong Objective C, b\u1ea1n c\u00f3 th\u1ec3 kh\u1edfi t\u1ea1o m\u1ea3ng t\u1eebng c\u00e1i m\u1ed9t ho\u1eb7c ho\u00e0n th\u00e0nh m\u1ea3ng c\u00f9ng nhau (Ho\u1eb7c ch\u00fang ta c\u00f3 th\u1ec3 n\u00f3i nhi\u1ec1u gi\u00e1 tr\u1ecb c\u00f9ng nhau). \u0110\u1ec3 kh\u1edfi t\u1ea1o t\u1eebng m\u1ea3ng m\u1ed9t, b\u1ea1n c\u1ea7n g\u00e1n gi\u00e1 tr\u1ecb t\u1ea1i ch\u1ec9 m\u1ee5c \u0111\u00e3 ch\u1ec9 \u0111\u1ecbnh.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Kh\u1edfi t\u1ea1o to\u00e0n b\u1ed9 m\u1ea3ng<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u0110\u1ec3 kh\u1edfi t\u1ea1o to\u00e0n b\u1ed9 m\u1ea3ng c\u00f9ng nhau, b\u1ea1n ph\u1ea3i g\u00e1n t\u1ea5t c\u1ea3 gi\u00e1 tr\u1ecb b\u1eb1ng d\u1ea5u ngo\u1eb7c nh\u1ecdn ({}). \u0110\u1ed9 d\u00e0i c\u1ee7a d\u1ea5u ngo\u1eb7c nh\u1ecdn b\u1eb1ng v\u1edbi k\u00edch th\u01b0\u1edbc c\u1ee7a m\u1ea3ng, ngh\u0129a l\u00e0 n\u1ebfu k\u00edch th\u01b0\u1edbc c\u1ee7a m\u1ea3ng l\u00e0 10 th\u00ec d\u1ea5u ngo\u1eb7c nh\u1ecdn ch\u1ec9 l\u01b0u tr\u1eef 10 ph\u1ea7n t\u1eed.<\/p>\n\n\n\n<p>V\u00ed d\u1ee5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int ArrayName&#91;5] = {2, 5, 7, 3, 2}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Truy c\u1eadp c\u00e1c ph\u1ea7n t\u1eed m\u1ea3ng b\u1eb1ng ch\u1ec9 m\u1ee5c<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u0110\u1ec3 truy c\u1eadp c\u00e1c ph\u1ea7n t\u1eed m\u1ea3ng, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ch\u1ec9 m\u1ee5c. V\u00ec v\u1eady, h\u00e3y vi\u1ebft s\u1ed1 ch\u1ec9 m\u1ee5c gi\u1eefa c\u00e1c d\u1ea5u ngo\u1eb7c vu\u00f4ng sau t\u00ean m\u1ea3ng.&nbsp;<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5 1<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int rollno = roll_no_array&#91;2];<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3, b\u1ea1n \u0111ang truy c\u1eadp \u201croll no\u201d t\u1eeb m\u1ea3ng roll no b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng ch\u1ec9 m\u1ee5c. M\u1ed9t m\u1ea3ng lu\u00f4n b\u1eaft \u0111\u1ea7u t\u1eeb s\u1ed1 kh\u00f4ng n\u00ean trong v\u00ed d\u1ee5 n\u00e0y, b\u1ea1n \u0111ang truy c\u1eadp ph\u1ea7n t\u1eed th\u1ee9 ba c\u1ee7a m\u1ea3ng.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5 2:<\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to access array using index\n#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;])\n{\n    NSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n        \/\/ Roll no array declaration\n    int roll_no_array&#91;] = {55, 78, 89, 99, 250};\n        \/\/ Accessing the array element from the roll\n    \/\/ no array elements is 89\n    int rollno = roll_no_array&#91;2];\n        \/\/ Print the element\n    printf(\"Roll No is = %d \", rollno);\n        &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Roll No is = 89<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Truy c\u1eadp c\u00e1c ph\u1ea7n t\u1eed m\u1ea3ng b\u1eb1ng v\u00f2ng l\u1eb7p<\/strong><\/li>\n<\/ul>\n\n\n\n<p>V\u00f2ng l\u1eb7p l\u00e0 m\u1ed9t c\u00e1ch r\u1ea5t hi\u1ec7u qu\u1ea3 \u0111\u1ec3 truy c\u1eadp m\u1ea3ng v\u00ec n\u1ebfu ch\u00fang ta c\u00f3 100 ph\u1ea7n t\u1eed trong m\u1ea3ng, th\u00ec r\u1ea5t kh\u00f3 \u0111\u1ec3 truy c\u1eadp t\u1ea5t c\u1ea3 c\u00e1c ph\u1ea7n t\u1eed th\u00f4ng qua ch\u1ec9 m\u1ee5c. V\u00ec v\u1eady, s\u1eed d\u1ee5ng v\u00f2ng l\u1eb7p for, ch\u00fang ta c\u00f3 th\u1ec3 l\u1eb7p qua t\u1eebng ph\u1ea7n t\u1eed c\u1ee7a m\u1ea3ng. Ch\u00fang ta c\u0169ng c\u00f3 th\u1ec3 \u0111\u1ea3o ng\u01b0\u1ee3c m\u1ea3ng b\u1eb1ng v\u00f2ng l\u1eb7p.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong>:<\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Objective-C program to access array using loop\n#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;])\n{\n    NSAutoreleasePool * pool = &#91;&#91;NSAutoreleasePool alloc] init];\n        \/\/ Roll no array declaration\n    int roll_no_array&#91;5] = {55, 78, 89, 99, 250}, i;\n    \/\/ Here we are accessing the roll no using loop\n    printf(\"Roll No is = \");\n    for(i = 0; i &lt; 5; i++)\n        printf(\"%d \", roll_no_array&#91;i]);\n        &#91;pool drain];\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Roll No is = 55 78 89 99 250<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"chuoi-trong-objective-c-la-gi\"><strong>Chu\u1ed7i trong Objective-C l\u00e0 g\u00ec?<\/strong><\/h4>\n\n\n\n<p>Trong Objective-C, chu\u1ed7i l\u00e0 m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng bi\u1ec3u di\u1ec5n m\u1ed9t chu\u1ed7i k\u00fd t\u1ef1. Chu\u1ed7i c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c t\u1ea1o b\u1eb1ng m\u1ed9t s\u1ed1 l\u1edbp v\u00e0 ph\u01b0\u01a1ng th\u1ee9c t\u00edch h\u1ee3p, cho ph\u00e9p b\u1ea1n thao t\u00e1c v\u0103n b\u1ea3n v\u00e0 th\u1ef1c hi\u1ec7n nhi\u1ec1u thao t\u00e1c kh\u00e1c nhau.<\/p>\n\n\n\n<p>C\u00f3 3 lo\u1ea1i chu\u1ed7i th\u01b0\u1eddng \u0111\u01b0\u1ee3c d\u00f9ng trong Objective-C v\u00e0 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c ph\u1ed5 bi\u1ebfn g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NSString<\/strong>: \u0110\u00e2y l\u00e0 m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng b\u1ea5t bi\u1ebfn bi\u1ec3u di\u1ec5n m\u1ed9t chu\u1ed7i k\u00fd t\u1ef1. Sau khi \u0111\u01b0\u1ee3c t\u1ea1o, n\u00f3 kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i. NSString l\u00e0 lo\u1ea1i chu\u1ed7i \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn nh\u1ea5t trong Objective-C.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u01b0\u01a1ng th\u1ee9c<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td>rangeOfString<\/td><td>T\u00ecm ki\u1ebfm chu\u1ed7i con<\/td><td><code>[text rangeOfString:@\u201dkeyword\u201d]<\/code><\/td><\/tr><tr><td>stringByReplacingOccurrencesOfString:withString:<\/td><td>Thay th\u1ebf chu\u1ed7i con<\/td><td><code>[text stringByReplacingOccurrencesOfString:@\u201ca\u201d withString:@\u201cb\u201d]<\/code><\/td><\/tr><tr><td>hasPrefix:<\/td><td>Ki\u1ec3m tra ti\u1ec1n t\u1ed1<\/td><td><code>[url hasPrefix:@\u201chttps\u201d]<\/code><\/td><\/tr><tr><td>hasSuffix:<\/td><td>Ki\u1ec3m tra h\u1eadu t\u1ed1<\/td><td><code>[filename hasSuffix:@\u201c.txt\u201d]<\/code><\/td><\/tr><tr><td>lowercaseString<\/td><td>Chuy\u1ec3n th\u00e0nh ch\u1eef th\u01b0\u1eddng<\/td><td><code>[name lowercaseString]<\/code><\/td><\/tr><tr><td>uppercaseString<\/td><td>Chuy\u1ec3n th\u00e0nh ch\u1eef hoa<\/td><td><code>[name uppercaseString]<\/code><\/td><\/tr><tr><td>componentsSeparatedByString:<\/td><td>T\u00e1ch chu\u1ed7i<\/td><td><code>[csv componentsSeparatedByString:@\u201d,\u201d]<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NSMutableString: <\/strong>\u0110\u00e2y l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 th\u1ec3 thay \u0111\u1ed5i, bi\u1ec3u di\u1ec5n m\u1ed9t chu\u1ed7i k\u00fd t\u1ef1. C\u00f3 th\u1ec3 s\u1eeda \u0111\u1ed5i sau khi t\u1ea1o v\u00e0 c\u00f3 th\u1ec3 th\u00eam ho\u1eb7c x\u00f3a c\u00e1c k\u00fd t\u1ef1 m\u1edbi.<\/li>\n<\/ul>\n\n\n\n<p>C\u00e1c ph\u01b0\u01a1ng th\u1ee9c ph\u1ed5 bi\u1ebfn c\u1ee7a NSMutableString g\u1ed3m:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NSMutableString *mutable = &#91;NSMutableString stringWithString:@\u201cHello\u201d];<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mutable appendString:@\u201d, world!\u201d]; \/\/ Th\u00eam chu\u1ed7i<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mutable insertString:@\u201d Objective-C\u201d atIndex:5]; \/\/ Ch\u00e8n chu\u1ed7i<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mutable deleteCharactersInRange:NSMakeRange(0, 6)]; \/\/ Xo\u00e1 k\u00fd t\u1ef1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mutable replaceCharactersInRange:NSMakeRange(0, 9) withString:@\u201cHi\u201d]; \/\/ Thay th\u1ebf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CFString:<\/strong> \u0110\u00e2y l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng Core Foundation bi\u1ec3u di\u1ec5n m\u1ed9t chu\u1ed7i k\u00fd t\u1ef1 Unicode.<\/li>\n<\/ul>\n\n\n\n<p>Ngo\u00e0i ra, Objective-C c\u00f2n cung c\u1ea5p m\u1ed9t s\u1ed1 l\u1edbp v\u00e0 ph\u01b0\u01a1ng th\u1ee9c t\u00edch h\u1ee3p \u0111\u1ec3 t\u1ea1o v\u00e0 thao t\u00e1c chu\u1ed7i. C\u00e1c ph\u01b0\u01a1ng th\u1ee9c \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn nh\u1ea5t l\u00e0:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Ph\u01b0\u01a1ng th\u1ee9c<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><\/tr><tr><td><strong>length<\/strong><\/td><td>\u0110\u00e2y l\u00e0 ph\u01b0\u01a1ng ph\u00e1p \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u00ednh \u0111\u1ed9 d\u00e0i c\u1ee7a chu\u1ed7i.<\/td><\/tr><tr><td><strong>stringWithFormat<\/strong><\/td><td>\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ecbnh d\u1ea1ng m\u1ed9t chu\u1ed7i c\u00f3 gi\u00e1 tr\u1ecb. C\u00e1c \u0111\u1ecbnh d\u1ea1ng ph\u1ed5 bi\u1ebfn g\u1ed3m:%@: Chu\u1ed7i&nbsp;%d: S\u1ed1 nguy\u00ean%lu: S\u1ed1 nguy\u00ean kh\u00f4ng d\u1ea5u%f: S\u1ed1 th\u1ef1c<\/td><\/tr><tr><td><strong>substringWithRange<\/strong><\/td><td>\u0110\u00e2y l\u00e0 ph\u01b0\u01a1ng ph\u00e1p \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u1ea5y chu\u1ed7i con c\u1ee7a chu\u1ed7i.<\/td><\/tr><tr><td><strong>isEqualToString<\/strong><\/td><td>\u0110\u00e2y l\u00e0 ph\u01b0\u01a1ng ph\u00e1p \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 so s\u00e1nh xem hai chu\u1ed7i c\u00f3 b\u1eb1ng nhau kh\u00f4ng.<\/td><\/tr><tr><td><strong>stringByAppendingFormat<\/strong><\/td><td>\u0110\u00e2y l\u00e0 ph\u01b0\u01a1ng ph\u00e1p \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u00eam m\u1ed9t chu\u1ed7i \u0111\u00e3 \u0111\u1ecbnh d\u1ea1ng v\u00e0o cu\u1ed1i chu\u1ed7i.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>V\u00ed d\u1ee5 1: <\/strong>T\u1ea1o chu\u1ed7i b\u1eb1ng NSString<\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;]){\n  \/\/ define string\nNSString *myString = @\"Hello, World!\";\n\/\/ print result\nNSLog(@\"%@\", myString);\n   return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdKxh4ZeMjlXx7YO7vFcc1145BgP3gXTcVElFKDYZBWoSymS_4sN5KfXsszBQj2eeOvKE4BZ311Gmw9hiMmunlpMollW28ZZ3iA_fxiyXJQ_Iskxox2uTdg8QoLusrCCSUPg17kFA?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>V\u00ed d\u1ee5 2:<\/strong> \u0110\u1ecbnh d\u1ea1ng chu\u1ed7i c\u00e1c gi\u00e1 tr\u1ecb b\u1eb1ng <code>stringWithFormat<\/code><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;]){\n\/\/ create a int variable\nint count = 10;\n\/\/ format a string with a value using stringWithFormat\nNSString *myFormattedString = &#91;NSString stringWithFormat:@\"I have %d apples.\", count];\n\/\/ print result\nNSLog(@\"%@\", myFormattedString);\nreturn 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfn1387M3ySBnPErD_r8uP2k11Ew2oee9LOsWVLdauNYIJj2f5tcdp8JdhMR-ruVSrad_L7KrutCUN5ed05pnEtS5ZayIt99Qxc2PZ3JQZQRcGJtlH2smnUgVTAI7m3WKxTAhLOEA?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>V\u00ed d\u1ee5 3:<\/strong> T\u1ea1o v\u00e0 thao t\u00e1c v\u1edbi chu\u1ed7i trong Objective-C<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main (int argc, const char * argv&#91;]){\n\/\/ Create a string using the NSString class\nNSString *myString = @\"Hello, World!\";\n\/\/ Get the length of the string\nNSUInteger length = &#91;myString length];\n\/\/ Get a substring of the string\nNSString *substring = &#91;myString substringWithRange:NSMakeRange(7, 5)];\n\/\/ Compare the string to another string\nBOOL isEqual = &#91;myString isEqualToString:@\"Hello, World!\"];\n\/\/ Create a mutable string using the NSMutableString class\nNSMutableString *mutableString = &#91;NSMutableString stringWithString:@\"Hello\"];\n\/\/ Append a string to the end of the mutable string\n&#91;mutableString appendString:@\" World!\"];\n\/\/ Add two strings together\nNSString *string1 = @\"Hello\";\nNSString *string2 = @\"World\";\nNSString *result = &#91;string1 stringByAppendingFormat:@\" %@\", string2];\n\/\/ Print the results to the console\nNSLog(@\"Original string: %@\", myString);\nNSLog(@\"Length of string: %lu\", length);\nNSLog(@\"Substring of string: %@\", substring);\nNSLog(@\"String is equal: %d\", isEqual);\nNSLog(@\"Mutable string: %@\", mutableString);\nNSLog(@\"Concatenated string: %@\", result);\nreturn 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXca1yYS3hWZbA66cbp81FR0e--nm09oR4a8Y8vmR5aS0v9U0mJbV3ob_glyHBrnN7bS7Ty5W4nS5cDbv23OgKx-w0S-G6SvRlYiSvNszfsy6BL1c8ys1QpdMprm0VS_kyHo1Z5K?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"cach-xu-ly-tap-tin-trong-objective-c\"><strong>C\u00e1ch x\u1eed l\u00fd t\u1eadp tin trong Objective-C<\/strong><\/h4>\n\n\n\n<p>Trong Objective C, x\u1eed l\u00fd t\u1ec7p \u0111\u1ea1t \u0111\u01b0\u1ee3c th\u00f4ng qua vi\u1ec7c s\u1eed d\u1ee5ng nhi\u1ec1u l\u1edbp v\u00e0 ph\u01b0\u01a1ng th\u1ee9c kh\u00e1c nhau do khu\u00f4n kh\u1ed5 Foundation cung c\u1ea5p. C\u00e1c l\u1edbp n\u00e0y cung c\u1ea5p giao di\u1ec7n c\u1ea5p cao \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c, tr\u1eebu t\u01b0\u1ee3ng h\u00f3a nhi\u1ec1u chi ti\u1ebft c\u1ea5p th\u1ea5p li\u00ean quan \u0111\u1ebfn I\/O t\u1ec7p.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Ki\u1ec3u v\u00e0 ki\u1ec3u con (Types v\u00e0 Subtypes)<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Trong Objective C, vi\u1ec7c x\u1eed l\u00fd t\u1ec7p c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c ph\u00e2n lo\u1ea1i th\u00e0nh hai lo\u1ea1i: \u0111\u1ecdc v\u00e0 ghi (vi\u1ebft). Trong \u0111\u00f3, \u0111\u1ecdc c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c chia th\u00e0nh hai lo\u1ea1i ph\u1ee5: truy c\u1eadp tu\u1ea7n t\u1ef1 v\u00e0 truy c\u1eadp ng\u1eabu nhi\u00ean; Ghi c\u0169ng c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c chia th\u00e0nh hai lo\u1ea1i ph\u1ee5: ghi \u0111\u00e8 v\u00e0 th\u00eam v\u00e0o.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td colspan=\"2\"><strong>\u0110\u1ecdc<\/strong><\/td><td colspan=\"2\"><strong>Ghi<\/strong><\/td><\/tr><tr><td><strong>Tu\u1ea7n t\u1ef1<\/strong><\/td><td><strong>Ng\u1eabu nhi\u00ean<\/strong><\/td><td><strong>Ghi \u0111\u00e8<\/strong><\/td><td><strong>Th\u00eam v\u00e0o<\/strong><\/td><\/tr><tr><td>Truy c\u1eadp tu\u1ea7n t\u1ef1 li\u00ean quan \u0111\u1ebfn vi\u1ec7c \u0111\u1ecdc d\u1eef li\u1ec7u t\u1eeb m\u1ed9t t\u1ec7p theo c\u00e1ch tuy\u1ebfn t\u00ednh t\u1eeb \u0111\u1ea7u \u0111\u1ebfn cu\u1ed1i.<\/td><td>\u0110\u1ecdc d\u1eef li\u1ec7u t\u1eeb b\u1ea5t k\u1ef3 v\u1ecb tr\u00ed n\u00e0o trong t\u1ec7p<\/td><td>Thay th\u1ebf n\u1ed9i dung c\u1ee7a t\u1ec7p b\u1eb1ng d\u1eef li\u1ec7u m\u1edbi<\/td><td>Th\u00eam d\u1eef li\u1ec7u m\u1edbi v\u00e0o cu\u1ed1i t\u1ec7p hi\u1ec7n c\u00f3.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> C\u00e1ch \u0111\u1ecdc v\u00e0 ghi t\u1ec7p trong Objective-C<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\n\nint main(int argc, const char *argv&#91;]) {\n  @autoreleasepool {\n    NSFileManager *fileManager = &#91;NSFileManager defaultManager];\n    NSError *error = nil;\n\n    \/\/ 1. L\u1ea5y \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ebfn th\u01b0 m\u1ee5c Documents c\u1ee7a \u1ee9ng d\u1ee5ng\n    \/\/ \u0110\u00e2y l\u00e0 n\u01a1i an to\u00e0n v\u00e0 ph\u00f9 h\u1ee3p \u0111\u1ec3 l\u01b0u tr\u1eef c\u00e1c t\u1ec7p do ng\u01b0\u1eddi d\u00f9ng t\u1ea1o ra.\n    NSArray *paths = &#91;fileManager URLsForDirectory:NSDocumentDirectory\n                                         inDomains:NSUserDomainMask];\n    if (&#91;paths count] == 0) {\n      NSLog(@\"Kh\u00f4ng th\u1ec3 t\u00ecm th\u1ea5y th\u01b0 m\u1ee5c Documents.\");\n      return 1;  \/\/ Tho\u00e1t v\u1edbi m\u00e3 l\u1ed7i\n    }\n    NSURL *documentsDirectoryURL = paths&#91;0];\n    NSURL *fileURL =\n        &#91;documentsDirectoryURL URLByAppendingPathComponent:@\"myFile.txt\"];\n    NSString *filePath = &#91;fileURL path];  \/\/ L\u1ea5y chu\u1ed7i \u0111\u01b0\u1eddng d\u1eabn n\u1ebfu c\u1ea7n (m\u1ed9t s\u1ed1\n                                          \/\/ API c\u0169 h\u01a1n c\u00f3 th\u1ec3 y\u00eau c\u1ea7u)\n\n    NSLog(@\"S\u1ebd ghi v\u00e0 \u0111\u1ecdc t\u1eeb t\u1ec7p t\u1ea1i: %@\", filePath);\n\n    \/\/ --- Writing to a file ---\n    NSString *contentToWrite =\n        @\"Hello World from a sandboxed app with error checking!\";\n\n    \/\/ Ghi t\u1ec7p v\u00e0 ki\u1ec3m tra l\u1ed7i\n    BOOL successWrite = &#91;contentToWrite writeToFile:filePath\n                                         atomically:YES\n                                           encoding:NSUTF8StringEncoding\n                                              error:&amp;error];\n\n    if (successWrite) {\n      NSLog(@\"Ghi t\u1ec7p th\u00e0nh c\u00f4ng!\");\n    } else {\n      NSLog(@\"Ghi t\u1ec7p th\u1ea5t b\u1ea1i. L\u1ed7i: %@\", &#91;error localizedDescription]);\n      \/\/ B\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m tra error.domain v\u00e0 error.code \u0111\u1ec3 x\u1eed l\u00fd c\u00e1c lo\u1ea1i l\u1ed7i c\u1ee5\n      \/\/ th\u1ec3 V\u00ed d\u1ee5: if (&#91;error.domain isEqualToString:NSCocoaErrorDomain] &amp;&amp;\n      \/\/ error.code == NSFileWriteNoPermissionError) { ... }\n    }\n\n    \/\/ \u0110\u1eb7t l\u1ea1i error th\u00e0nh nil tr\u01b0\u1edbc thao t\u00e1c ti\u1ebfp theo\n    error = nil;\n\n    \/\/ --- Reading from a file ---\n    \/\/ \u0110\u1ecdc n\u1ed9i dung t\u1ec7p v\u00e0 ki\u1ec3m tra l\u1ed7i\n    NSString *fileContent =\n        &#91;NSString stringWithContentsOfFile:filePath\n                                  encoding:NSUTF8StringEncoding\n                                     error:&amp;error];\n\n    if (fileContent) {\n      NSLog(@\"\u0110\u1ecdc t\u1ec7p th\u00e0nh c\u00f4ng. N\u1ed9i dung:\");\n      NSLog(@\"%@\", fileContent);\n    } else {\n      NSLog(@\"\u0110\u1ecdc t\u1ec7p th\u1ea5t b\u1ea1i. L\u1ed7i: %@\", &#91;error localizedDescription]);\n      if (error) {\n        \/\/ V\u00ed d\u1ee5: n\u1ebfu t\u1ec7p kh\u00f4ng t\u1ed3n t\u1ea1i, b\u1ea1n c\u00f3 th\u1ec3 nh\u1eadn \u0111\u01b0\u1ee3c m\u1ed9t l\u1ed7i nh\u01b0:\n        \/\/ \"The file \u201cmyFile.txt\u201d couldn\u2019t be opened because there is no such\n        \/\/ file.\" (NSCocoaErrorDomain, code 260)\n      }\n    }\n  }\n  return 0;\n}<\/code><\/pre>\n\n\n\n<p>Trong v\u00ed d\u1ee5 n\u00e0y, \u0111\u1ea7u ti\u00ean b\u1ea1n ghi chu\u1ed7i \u201cHello World!\u201d v\u00e0o m\u1ed9t t\u1ec7p n\u1eb1m t\u1ea1i \u201c\/path\/to\/file.txt\u201d. Sau \u0111\u00f3, \u0111\u1ecdc n\u1ed9i dung c\u1ee7a c\u00f9ng m\u1ed9t t\u1ec7p v\u00e0 in n\u00f3 ra b\u1ea3ng \u0111i\u1ec1u khi\u1ec3n.<\/p>\n\n\n\n<p><strong>C\u00e1c ph\u01b0\u01a1ng th\u1ee9c x\u1eed l\u00fd t\u1ec7p trong Objective-C<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>writeToFile:atomically:encoding:error:<\/code>: Ph\u01b0\u01a1ng th\u1ee9c n\u00e0y \u0111\u01b0\u1ee3c cung c\u1ea5p b\u1edfi l\u1edbp NSString v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ghi m\u1ed9t chu\u1ed7i v\u00e0o t\u1ec7p.<\/li>\n\n\n\n<li><code>stringWithContentsOfFile:encoding:error:<\/code>: Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y c\u0169ng \u0111\u01b0\u1ee3c cung c\u1ea5p b\u1edfi l\u1edbp NSString v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ecdc m\u1ed9t chu\u1ed7i t\u1eeb m\u1ed9t t\u1ec7p.<\/li>\n\n\n\n<li><code>createDirectoryAtPath:withIntermediateDirectories:attributes:error:<\/code>: Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y \u0111\u01b0\u1ee3c cung c\u1ea5p b\u1edfi l\u1edbp NSFileManager v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o th\u01b0 m\u1ee5c.<\/li>\n\n\n\n<li><code>writeToFile:atomically:<\/code>: Ph\u01b0\u01a1ng th\u1ee9c n\u00e0y \u0111\u01b0\u1ee3c cung c\u1ea5p b\u1edfi l\u1edbp NSData v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ghi d\u1eef li\u1ec7u nh\u1ecb ph\u00e2n v\u00e0o t\u1ec7p.<\/li>\n\n\n\n<li><code>dataWithContentsOfFile:<\/code>: Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y c\u0169ng \u0111\u01b0\u1ee3c cung c\u1ea5p b\u1edfi l\u1edbp NSData v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ecdc d\u1eef li\u1ec7u nh\u1ecb ph\u00e2n t\u1eeb m\u1ed9t t\u1ec7p<\/li>\n<\/ul>\n\n\n\n<p><strong>Sao ch\u00e9p d\u1eef li\u1ec7u t\u1eeb t\u1ec7p n\u00e0y sang t\u1ec7p kh\u00e1c<\/strong><\/p>\n\n\n\n<p>Ch\u01b0\u01a1ng tr\u00ecnh n\u00e0y nh\u1eadn hai \u0111\u1ed1i s\u1ed1 d\u00f2ng l\u1ec7nh: \u0111\u01b0\u1eddng d\u1eabn t\u1ec7p ngu\u1ed3n v\u00e0 t\u1ec7p \u0111\u00edch. N\u00f3 ki\u1ec3m tra s\u1ef1 t\u1ed3n t\u1ea1i c\u1ee7a t\u1ec7p ngu\u1ed3n v\u00e0 kh\u1ea3 n\u0103ng t\u1ea1o t\u1ec7p \u0111\u00edch. N\u1ebfu h\u1ee3p l\u1ec7, ch\u01b0\u01a1ng tr\u00ecnh d\u00f9ng NSInputStream v\u00e0 NSOutputStream \u0111\u1ec3 sao ch\u00e9p d\u1eef li\u1ec7u. N\u1ebfu x\u1ea3y ra l\u1ed7i, ch\u01b0\u01a1ng tr\u00ecnh in th\u00f4ng b\u00e1o l\u1ed7i v\u00e0 tho\u00e1t v\u1edbi m\u00e3 l\u1ed7i. N\u1ebfu th\u00e0nh c\u00f4ng, n\u00f3 in th\u00f4ng b\u00e1o ho\u00e0n t\u1ea5t v\u00e0 tho\u00e1t b\u00ecnh th\u01b0\u1eddng.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5<\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) {\n    @autoreleasepool {\n        \/\/ Step 1: Check command line arguments\n        if (argc &lt; 3) {\n            NSLog(@\"Usage: %@ source_file destination_file\", &#91;NSString stringWithUTF8String:argv&#91;0]]);\n            return 1;\n        }\n                \/\/ Step 2: Open source file\n        FILE *source_file = fopen(argv&#91;1], \"r\");\n        if (source_file == NULL) {\n            NSLog(@\"Error opening source file.\");\n            return 1;\n        }\n                \/\/ Step 3: Open destination file\n        FILE *destination_file = fopen(argv&#91;2], \"w\");\n        if (destination_file == NULL) {\n            NSLog(@\"Error opening destination file.\");\n            return 1;\n        }\n                \/\/ Step 4: Read from source file and write to destination file\n        char buffer&#91;1024];\n        while (fgets(buffer, 1024, source_file)) {\n            fputs(buffer, destination_file);\n        }\n                \/\/ Step 5: Close files\n        fclose(source_file);\n        fclose(destination_file);\n                NSLog(@\"Data copied from %@ to %@.\", &#91;NSString stringWithUTF8String:argv&#91;1]], &#91;NSString stringWithUTF8String:argv&#91;2]]);\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXd5EviWxxdXQ5LDNC3Nsmcn6atxI8QNDvDPIkvzXzAZoQixlmy595-eqXRxoe-NY40jDRScqQDyDDpf7ujNmca914CuB8bQWv8OOZ5gXVC6UbA8RCzwYhpZ0zv0QTc6KtDHktRY?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Th\u00eam d\u1eef li\u1ec7u v\u00e0o m\u1ed9t t\u1ec7p hi\u1ec7n c\u00f3<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadn hai \u0111\u1ed1i s\u1ed1 d\u00f2ng l\u1ec7nh: \u0111\u01b0\u1eddng d\u1eabn t\u1ec7p v\u00e0 d\u1eef li\u1ec7u c\u1ea7n th\u00eam. N\u00f3 ki\u1ec3m tra xem t\u1ec7p c\u00f3 t\u1ed3n t\u1ea1i v\u00e0 c\u00f3 th\u1ec3 ghi \u0111\u01b0\u1ee3c kh\u00f4ng. N\u1ebfu h\u1ee3p l\u1ec7, ch\u01b0\u01a1ng tr\u00ecnh d\u00f9ng NSFileHandle \u0111\u1ec3 ghi th\u00eam d\u1eef li\u1ec7u v\u00e0o cu\u1ed1i t\u1ec7p. N\u1ebfu x\u1ea3y ra l\u1ed7i, ch\u01b0\u01a1ng tr\u00ecnh in th\u00f4ng b\u00e1o l\u1ed7i v\u00e0 tho\u00e1t v\u1edbi m\u00e3 l\u1ed7i; n\u1ebfu th\u00e0nh c\u00f4ng, n\u00f3 in th\u00f4ng b\u00e1o ho\u00e0n t\u1ea5t v\u00e0 tho\u00e1t b\u00ecnh th\u01b0\u1eddng.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong><\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) {\n    @autoreleasepool {\n\/\/ Step 1: Check command line arguments\n        if (argc &lt; 3) {\n            NSLog(@\"Usage: %@ file_path data_to_append\", &#91;NSString stringWithUTF8String:argv&#91;0]]);\n            return 1;\n        }\n\/\/ Step 2: Open file in append mode\n        FILE *file = fopen(argv&#91;1], \"a\");\n        if (file == NULL) {\n            NSLog(@\"Error opening file.\");\n            return 1;\n        }\n\/\/ Step 3: Append data to file\n        fputs(argv&#91;2], file);\n \/\/ Step 4: Close file\n        fclose(file);\n                NSLog(@\"Data appended to %@.\", &#91;NSString stringWithUTF8String:argv&#91;1]]);\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXe5BZgXejYFlRBIGi0z7H888b4_t-fvNnW96IMpJaGAvs3UIDnQdhwW6EY-4XDc_aqlfOt6kUzs3s7f74sXOH7bvTxBDU_bD4MGgVLMZSn1PJhaKkhgNH9YOu3bCQp_D4Q1ayMI?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Ki\u1ec3m tra t\u1eadp tin c\u00f3 t\u1ed3n t\u1ea1i hay kh\u00f4ng v\u00e0 x\u00f3a n\u00f3<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadn m\u1ed9t \u0111\u1ed1i s\u1ed1 d\u00f2ng l\u1ec7nh l\u00e0 \u0111\u01b0\u1eddng d\u1eabn t\u1ec7p c\u1ea7n ki\u1ec3m tra. N\u1ebfu t\u1ec7p t\u1ed3n t\u1ea1i v\u00e0 c\u00f3 th\u1ec3 x\u00f3a \u0111\u01b0\u1ee3c, ch\u01b0\u01a1ng tr\u00ecnh d\u00f9ng NSFileManager \u0111\u1ec3 x\u00f3a t\u1ec7p. N\u1ebfu c\u00f3 l\u1ed7i, n\u00f3 in th\u00f4ng b\u00e1o l\u1ed7i v\u00e0 tho\u00e1t v\u1edbi m\u00e3 l\u1ed7i; n\u1ebfu th\u00e0nh c\u00f4ng, in th\u00f4ng b\u00e1o ho\u00e0n t\u1ea5t v\u00e0 tho\u00e1t b\u00ecnh th\u01b0\u1eddng.<\/p>\n\n\n\n<p>V\u00ed d\u1ee5:<\/p>\n\n\n\n<p><strong>Input<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#import &lt;Foundation\/Foundation.h&gt;\nint main(int argc, const char * argv&#91;]) {\n    @autoreleasepool {\n        \/\/ Step 1: Check command line arguments\n        if (argc &lt; 2) {\n            NSLog(@\"Usage: %@ file_path\", &#91;NSString stringWithUTF8String:argv&#91;0]]);\n            return 1;\n        }      \n        \/\/ Step 2: Check if file exists\n        NSString *filePath = &#91;NSString stringWithUTF8String:argv&#91;1]];\n        if (&#91;&#91;NSFileManager defaultManager] fileExistsAtPath:filePath]) {\n            \/\/ Step 3: Delete file\n            NSError *error;\n            BOOL success = &#91;&#91;NSFileManager defaultManager] removeItemAtPath:filePath error:&amp;error];\n            if (!success) {\n                NSLog(@\"Error deleting file: %@\", &#91;error localizedDescription]);\n                return 1;\n            }    \n            NSLog(@\"File %@ deleted successfully.\", filePath);\n        } else {\n            NSLog(@\"File %@ does not exist.\", filePath);\n        }\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcdU7mA7ebYnGLB79PoHMI_PjzUQNfxBAzhS5HNwfQwQ5JtvNWFor2AShzcEjB2kIi0r8J5mJtR8MHHLcU9y6vEI8ZWIEt6vCffgRp--rqBhT_sfOMIE-Cm3G2An1xVUOFbDBAmQg?key=KwNvVUK09EnbIggZ5zHa78eh\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ngay-12-den-14-tong-hop-kien-thuc\"><strong>Ng\u00e0y 12 \u0111\u1ebfn 14: T\u1ed5ng h\u1ee3p ki\u1ebfn th\u1ee9c<\/strong><\/h3>\n\n\n\n<p>T\u1eeb ng\u00e0y th\u1ee9 12, sau khi \u0111\u00e3 n\u1eafm r\u00f5 to\u00e0n b\u1ed9 ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n, b\u1ea1n h\u00e3y t\u1ef1 m\u00ecnh v\u1ebd l\u1ea1i s\u01a1 \u0111\u1ed3 ho\u1eb7c l\u1eadp b\u1ea3ng h\u1ec7 th\u1ed1ng ki\u1ebfn th\u1ee9c m\u00e0 m\u00ecnh \u0111\u00e3 h\u1ecdc \u0111\u01b0\u1ee3c. Song song \u0111\u00f3, th\u1ef1c hi\u1ec7n c\u00e1c b\u00e0i t\u1eadp \u0111\u01a1n gi\u1ea3n c\u0169ng l\u00e0 m\u1ed9t c\u00e1ch hay \u0111\u1ec3 b\u1ea1n nh\u1edb l\u00e2u h\u01a1n.<\/p>\n\n\n\n<p>M\u1ed9t s\u1ed1 ch\u1ee7 \u0111\u1ec1 b\u00e0i t\u1eadp \u0111\u01a1n gi\u1ea3n m\u00e0 b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n v\u00e0 t\u00ecm th\u1ea5y h\u01b0\u1edbng d\u1eabn\/gi\u1ea3i \u0111\u00e1p t\u1eeb c\u00e1c ngu\u1ed3n tr\u00ean Internet nh\u01b0:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>B\u00e0i t\u1eadp 1: T\u1ea1o m\u1ed9t \u1ee9ng d\u1ee5ng iOS c\u01a1 b\u1ea3n hi\u1ec3n th\u1ecb d\u00f2ng ch\u1eef &#8220;Hello World&#8221;.<\/li>\n\n\n\n<li>B\u00e0i t\u1eadp 2: X\u00e2y d\u1ef1ng m\u1ed9t \u1ee9ng d\u1ee5ng m\u00e1y t\u00ednh th\u1ef1c hi\u1ec7n c\u00e1c ph\u00e9p t\u00ednh c\u01a1 b\u1ea3n nh\u01b0 c\u1ed9ng, tr\u1eeb, nh\u00e2n, chia.<\/li>\n\n\n\n<li>B\u00e0i t\u1eadp 3: T\u1ea1o m\u1ed9t \u1ee9ng d\u1ee5ng qu\u1ea3n l\u00fd c\u00f4ng vi\u1ec7c v\u1edbi kh\u1ea3 n\u0103ng th\u00eam, x\u00f3a v\u00e0 \u0111\u00e1nh d\u1ea5u ho\u00e0n th\u00e0nh.<\/li>\n\n\n\n<li>B\u00e0i t\u1eadp 4: Vi\u1ebft m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh in ra b\u1ea3ng c\u1eedu ch\u01b0\u01a1ng cho m\u1ed9t s\u1ed1 nguy\u00ean nh\u1eadp v\u00e0o.<\/li>\n\n\n\n<li>B\u00e0i t\u1eadp 5: X\u00e2y d\u1ef1ng m\u1ed9t \u1ee9ng d\u1ee5ng l\u01b0u tr\u1eef v\u00e0 hi\u1ec3n th\u1ecb th\u00f4ng tin c\u00e1 nh\u00e2n nh\u01b0 t\u00ean, tu\u1ed5i, gi\u1edbi t\u00ednh.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cac-cau-hoi-thuong-gap-ve-objective-c-tutorial\"><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_Objective-C_tutorial\"><\/span><strong>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Objective-C tutorial<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"de-hieu-het-objective-c-tutorial-mat-bao-lau\"><strong>\u0110\u1ec3 hi\u1ec3u h\u1ebft Objective-C tutorial m\u1ea5t bao l\u00e2u?<\/strong><\/h3>\n\n\n\n<p>Th\u1eddi gian \u0111\u1ec3 hi\u1ec3u h\u1ebft Objective-C tutorial c\u00f3 th\u1ec3 kh\u00e1c nhau \u1edf m\u1ed7i ng\u01b0\u1eddi. Tr\u01b0\u1eddng h\u1ee3p b\u1ea1n \u0111\u00e3 bi\u1ebft v\u00e0 th\u00e0nh th\u1ea1o l\u1eadp tr\u00ecnh, hi\u1ec3u h\u1ebft tutorial c\u00f3 th\u1ec3 m\u1ea5t kho\u1ea3ng 1 &#8211; 2 tu\u1ea7n v\u1edbi l\u1ed9 tr\u00ecnh ITviec \u0111\u00e3 \u0111\u01b0a ra trong b\u00e0i vi\u1ebft. Tuy nhi\u00ean, n\u1ebfu l\u00e0 ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u, c\u00f3 th\u1ec3 b\u1ea1n s\u1ebd m\u1ea5t kho\u1ea3ng 3 &#8211; 4 tu\u1ea7n \u0111\u1ec3 n\u1eafm v\u1eefng ki\u1ebfn th\u1ee9c v\u00e0 th\u1ef1c h\u00e0nh c\u01a1 b\u1ea3n.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hoc-lap-trinh-objective-c-co-kho-khong\"><strong>H\u1ecdc l\u1eadp tr\u00ecnh Objective C c\u00f3 kh\u00f3 kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>H\u1ecdc Objective-C c\u00f3 th\u1ec3 kh\u00f3 \u0111\u1ed1i v\u1edbi ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u, \u0111\u1eb7c bi\u1ec7t l\u00e0 do c\u00fa ph\u00e1p kh\u00e1c bi\u1ec7t v\u00e0 s\u1ef1 ph\u1ee9c t\u1ea1p c\u1ee7a h\u1ec7 sinh th\u00e1i \u0111i k\u00e8m. H\u1ecdc Objective-C, kh\u00f4ng ch\u1ec9 l\u00e0 h\u1ecdc m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh, m\u00e0 b\u1ea1n c\u00f2n l\u00e0m quen v\u1edbi runtime, compiler v\u00e0 c\u00e1c framework nh\u01b0 Cocoa\/Cocoa Touch.&nbsp;<\/p>\n\n\n\n<p>C\u00fa ph\u00e1p c\u1ee7a Objective-C v\u1edbi d\u1ea5u ngo\u1eb7c vu\u00f4ng v\u00e0 d\u1ea5u @ c\u00f3 th\u1ec3 g\u00e2y kh\u00f3 kh\u0103n cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u. Ngo\u00e0i ra, runtime \u0111\u1ed9ng v\u00e0 c\u00e1c framework l\u1edbn c\u0169ng g\u00f3p ph\u1ea7n l\u00e0m t\u0103ng \u0111\u1ed9 kh\u00f3 khi h\u1ecdc ng\u00f4n ng\u1eef n\u00e0y.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"nhung-khoa-hoc-nao-day-ve-objective-c\"><strong>Nh\u1eefng kho\u00e1 h\u1ecdc n\u00e0o d\u1ea1y v\u1ec1 Objective-C?<\/strong><\/h3>\n\n\n\n<p>\u0110\u1ec3 h\u1ecdc th\u00eam v\u1ec1 Objective-C, b\u1ea1n c\u00f3 th\u1ec3 tham kh\u1ea3o th\u00eam m\u1ed9t s\u1ed1 kh\u00f3a h\u1ecdc sau:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>\u0110\u1ed1i t\u01b0\u1ee3ng<\/strong><\/td><td><strong>T\u00ean kh\u00f3a h\u1ecdc<\/strong><\/td><td><strong>M\u00f4 t\u1ea3 kh\u00f3a h\u1ecdc<\/strong><\/td><\/tr><tr><td rowspan=\"3\"><strong>D\u00e0nh cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u<\/strong><\/td><td><a href=\"http:\/\/coursera.org\/learn\/objective-c\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Foundations of Objective-C App Development (Coursera)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc gi\u1edbi thi\u1ec7u c\u01a1 b\u1ea3n v\u1ec1 Objective-C, bao g\u1ed3m c\u00fa ph\u00e1p, l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng v\u00e0 s\u1eed d\u1ee5ng Xcode \u0111\u1ec3 ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng iOS.<\/td><\/tr><tr><td><a href=\"https:\/\/www.youtube.com\/playlist\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Learn Objective C for Beginners (Code Master)<\/strong><\/a><\/td><td>Chu\u1ed7i video gi\u00fap n\u1eafm v\u1eefng c\u00e1c kh\u00e1i ni\u1ec7m c\u01a1 b\u1ea3n nh\u01b0 bi\u1ebfn, l\u1edbp, ph\u01b0\u01a1ng th\u1ee9c, qu\u1ea3n l\u00fd b\u1ed9 nh\u1edb v\u00e0 ARC<\/td><\/tr><tr><td><a href=\"https:\/\/youtube.com\/playlist?list=PL23Revp-82LLqM6azUAr9at03whFNL9Ld&amp;si=LEH2H-cX2X0V5Vi9\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Objective-C tutorial series (Kodeco.com)<\/strong><\/a><\/td><td>Chu\u1ed7i video g\u1ed3m c\u00e1c ch\u1ee7 \u0111\u1ec1 t\u1eeb ki\u1ec3u d\u1eef li\u1ec7u c\u01a1 b\u1ea3n \u0111\u1ebfn c\u00e1c kh\u00e1i ni\u1ec7m n\u00e2ng cao nh\u01b0 protocols, delegates v\u00e0 runtime.<\/td><\/tr><tr><td rowspan=\"3\"><strong>D\u00e0nh cho l\u1eadp tr\u00ecnh vi\u00ean Swift<\/strong><\/td><td><a href=\"https:\/\/www.pluralsight.com\/courses\/swift-developers-objective-c\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Objective-C for Swift Developers (Pluralsight)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc ng\u1eafn gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean Swift hi\u1ec3u v\u00e0 s\u1eed d\u1ee5ng Objective-C trong c\u00e1c d\u1ef1 \u00e1n hi\u1ec7n c\u00f3.<\/td><\/tr><tr><td><a href=\"https:\/\/www.udemy.com\/course\/objectivec\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Objective-C Crash Course for Swift Developers (Udemy)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc nhanh d\u00e0nh cho l\u1eadp tr\u00ecnh vi\u00ean Swift, t\u1eadp trung v\u00e0o vi\u1ec7c vi\u1ebft v\u00e0 chuy\u1ec3n \u0111\u1ed5i m\u00e3 gi\u1eefa Swift v\u00e0 Objective-C.<\/td><\/tr><tr><td><a href=\"https:\/\/twostraws.gumroad.com\/l\/objcswift\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Objective-C for Swift Developers (Paul Hudson)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc t\u0103ng t\u1ed1c gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean Swift h\u1ecdc Objective-C th\u00f4ng qua c\u00e1c d\u1ef1 \u00e1n th\u1ef1c t\u1ebf v\u00e0 so s\u00e1nh c\u00fa ph\u00e1p gi\u1eefa hai ng\u00f4n ng\u1eef.<\/td><\/tr><tr><td rowspan=\"3\"><strong>Th\u1ef1c h\u00e0nh v\u00e0 chuy\u00ean s\u00e2u<\/strong><\/td><td><a href=\"https:\/\/www.udemy.com\/course\/objective-c-ios11\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>iOS 11 &amp; Objective-C &#8211; Complete Developer Course (Udemy)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc to\u00e0n di\u1ec7n v\u1ec1 ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng iOS 11 b\u1eb1ng Objective-C, bao g\u1ed3m vi\u1ec7c t\u1ea1o h\u01a1n 25 \u1ee9ng d\u1ee5ng th\u1ef1c t\u1ebf.<\/td><\/tr><tr><td><a href=\"https:\/\/www.udemy.com\/course\/ios-12-objective-c\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>iOS 12 &amp; Objective-C &#8211; Complete Developer Course (Udemy)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc t\u01b0\u01a1ng t\u1ef1, c\u1eadp nh\u1eadt cho iOS 12 v\u00e0 Xcode 10, gi\u00fap h\u1ecdc vi\u00ean ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng v\u00e0 tr\u00f2 ch\u01a1i \u0111\u1ea7y \u0111\u1ee7 t\u00ednh n\u0103ng.<\/td><\/tr><tr><td><a href=\"https:\/\/www.classcentral.com\/course\/linkedin-learning-objective-c-essential-training-78281\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Objective-C Essential Training (LinkedIn Learning)<\/strong><\/a><\/td><td>Kh\u00f3a h\u1ecdc cung c\u1ea5p ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 Objective-C, ph\u00f9 h\u1ee3p cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u v\u00e0 c\u00f3 th\u1ec3 truy c\u1eadp th\u00f4ng qua b\u1ea3n d\u00f9ng th\u1eed mi\u1ec5n ph\u00ed.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"tong-ket\"><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><strong>T\u1ed5ng k\u1ebft<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>V\u1edbi 14 ng\u00e0y h\u1ecdc theo l\u1ed9 tr\u00ecnh ITviec \u0111\u00e3 \u0111\u01b0a ra, b\u1ea1n \u0111\u00e3 \u0111i qua nh\u1eefng n\u1ec1n t\u1ea3ng quan tr\u1ecdng nh\u1ea5t c\u1ee7a ng\u00f4n ng\u1eef Objective-C. T\u1eeb nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 bi\u1ebfn, ki\u1ec3u d\u1eef li\u1ec7u, v\u00f2ng l\u1eb7p, \u0111i\u1ec1u ki\u1ec7n cho \u0111\u1ebfn nh\u1eefng ch\u1ee7 \u0111\u1ec1 n\u00e2ng cao nh\u01b0 l\u1edbp, \u0111\u1ed1i t\u01b0\u1ee3ng, thu\u1ed9c t\u00ednh, ph\u01b0\u01a1ng th\u1ee9c, m\u1ea3ng,&#8230;<\/p>\n\n\n\n<p>Tuy nhi\u00ean, \u0111\u1eebng \u0111\u1ec3 h\u00e0nh tr\u00ecnh h\u1ecdc t\u1eadp c\u1ee7a b\u1ea1n ch\u1ec9 d\u1eebng l\u1ea1i \u1edf Objective-C tutorial, m\u00e0 h\u00e3y ti\u1ebfp t\u1ee5c th\u1ef1c h\u00e0nh v\u1edbi nh\u1eefng d\u1ef1 \u00e1n \u0111\u01a1n gi\u1ea3n, nghi\u00ean c\u1ee9u th\u00eam v\u1ec1 UIKit, Foundation, Interface Builder trong Xcode,&#8230; \u0111\u1ec3 ph\u00e1t tri\u1ec3n h\u01a1n n\u1eefa kh\u1ea3 n\u0103ng l\u1eadp tr\u00ecnh c\u1ee7a m\u00ecnh nh\u00e9.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>D\u00f9 Swift \u0111\u00e3 tr\u1edf th\u00e0nh ng\u00f4n ng\u1eef ch\u00ednh th\u1ee9c khi ph\u00e1t tri\u1ec3n c\u00e1c \u1ee9ng d\u1ee5ng tr\u00ean n\u1ec1n t\u1ea3ng Apple th\u00ec vi\u1ec7c h\u1ecdc v\u00e0 hi\u1ec3u v\u1ec1 Objective-C v\u1eabn mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch cho l\u1eadp tr\u00ecnh vi\u00ean. N\u1ebfu b\u1ea1n l\u00e0 ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u t\u00ecm hi\u1ec3u v\u1ec1 ng\u00f4n ng\u1eef n\u00e0y, h\u00e3y c\u00f9ng ITviec th\u1ef1c hi\u1ec7n th\u1eed [&hellip;]<\/p>\n","protected":false},"author":213,"featured_media":88862,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-88546","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0 - ITviec Blog<\/title>\n<meta name=\"description\" content=\"H\u01b0\u1edbng d\u1eabn Objective-C tutorial gi\u00fap b\u1ea1n chinh ph\u1ee5c Objective-C t\u1eeb con s\u1ed1 0 \u0111\u1ec3 c\u00f3 n\u1ec1n t\u1ea3ng v\u1eefng ch\u1eafc khi l\u00e0m vi\u1ec7c v\u1edbi h\u1ec7 sinh th\u00e1i Apple.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0\" \/>\n<meta property=\"og:description\" content=\"D\u00f9 Swift \u0111\u00e3 tr\u1edf th\u00e0nh ng\u00f4n ng\u1eef ch\u00ednh th\u1ee9c khi ph\u00e1t tri\u1ec3n c\u00e1c \u1ee9ng d\u1ee5ng tr\u00ean n\u1ec1n t\u1ea3ng Apple th\u00ec vi\u1ec7c h\u1ecdc v\u00e0 hi\u1ec3u v\u1ec1 Objective-C v\u1eabn mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/objective-c-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-01T11:20:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-01T11:20:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"421\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Linh Trao\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Linh Trao\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"38 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0 - ITviec Blog","description":"H\u01b0\u1edbng d\u1eabn Objective-C tutorial gi\u00fap b\u1ea1n chinh ph\u1ee5c Objective-C t\u1eeb con s\u1ed1 0 \u0111\u1ec3 c\u00f3 n\u1ec1n t\u1ea3ng v\u1eefng ch\u1eafc khi l\u00e0m vi\u1ec7c v\u1edbi h\u1ec7 sinh th\u00e1i Apple.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/","og_locale":"vi_VN","og_type":"article","og_title":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0","og_description":"D\u00f9 Swift \u0111\u00e3 tr\u1edf th\u00e0nh ng\u00f4n ng\u1eef ch\u00ednh th\u1ee9c khi ph\u00e1t tri\u1ec3n c\u00e1c \u1ee9ng d\u1ee5ng tr\u00ean n\u1ec1n t\u1ea3ng Apple th\u00ec vi\u1ec7c h\u1ecdc v\u00e0 hi\u1ec3u v\u1ec1 Objective-C v\u1eabn mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch","og_url":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2025-07-01T11:20:40+00:00","article_modified_time":"2025-07-01T11:20:43+00:00","og_image":[{"width":800,"height":421,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png","type":"image\/png"}],"author":"Linh Trao","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Linh Trao","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"38 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/"},"author":{"name":"Linh Trao","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/6d1bcbfa05475cbc5a2eaf0727501a16"},"headline":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0","datePublished":"2025-07-01T11:20:40+00:00","dateModified":"2025-07-01T11:20:43+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/"},"wordCount":9441,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/","url":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/","name":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0 - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png","datePublished":"2025-07-01T11:20:40+00:00","dateModified":"2025-07-01T11:20:43+00:00","description":"H\u01b0\u1edbng d\u1eabn Objective-C tutorial gi\u00fap b\u1ea1n chinh ph\u1ee5c Objective-C t\u1eeb con s\u1ed1 0 \u0111\u1ec3 c\u00f3 n\u1ec1n t\u1ea3ng v\u1eefng ch\u1eafc khi l\u00e0m vi\u1ec7c v\u1edbi h\u1ec7 sinh th\u00e1i Apple.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/objective-c-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/07\/objective-c-tutorial-vippro-scaled.png","width":800,"height":421,"caption":"Objective-C tutorial - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/objective-c-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Objective-C tutorial: 14 ng\u00e0y t\u1ef1 h\u1ecdc hi\u1ec7u qu\u1ea3 qua v\u00ed d\u1ee5 th\u1ef1c t\u1ebf\u00a0"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/6d1bcbfa05475cbc5a2eaf0727501a16","name":"Linh Trao","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/trao-thi-tung-linh-author-e1709892478113-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/trao-thi-tung-linh-author-e1709892478113-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/trao-thi-tung-linh-author-e1709892478113-100x100.jpg","caption":"Linh Trao"},"url":"https:\/\/itviec.com\/blog\/author\/linh-trao\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/88546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/213"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=88546"}],"version-history":[{"count":4,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/88546\/revisions"}],"predecessor-version":[{"id":88868,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/88546\/revisions\/88868"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/88862"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=88546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=88546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=88546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}