[{"data":1,"prerenderedAt":277},["ShallowReactive",2],{"tag-labels":3,"site-header":4,"article-pascal-gradebook-capstone-en":75},{},{"featuredPost":5,"navigations":29},{"id":6,"title":7,"title_id":8,"slug":9,"excerpt":10,"excerpt_id":11,"has_translation":12,"published_at":13,"reading_time":14,"hidden_from_listing":15,"tags":16,"thumbnail_image":21,"og_image":22,"series":23,"authors":28},110,"When You Pick a Framework Just to Look Different","Ketika Pilih Framework Cuma Biar Kelihatan Beda","ketika-pilih-framework-cuma-biar-kelihatan-beda","The last time you chose a new framework or library, was it because your problem needed that tool, or because it sounded cool and few people around you were using it? That question is uncomfortable. Technology decisions are often made for reasons that never appear in any technical document.","Terakhir kali kamu milih framework atau library baru, itu karena masalahmu butuh alat itu, atau karena alatnya kedengaran keren dan belum banyak yang pakai? Pertanyaan ini nggak enak dijawab. Soalnya keputusan teknologi sering diambil dengan alasan yang nggak pernah ditulis di dokumen teknis mana pun.",true,"2026-10-06T15:25:21.000Z",5,false,[17,18,19,20],"karier","framework","opini","pengalaman",null,"\u002Fog\u002Fketika-pilih-framework-cuma-biar-kelihatan-beda.png",{"id":24,"title":25,"title_id":26,"slug":27},9,"Articles","Artikel","all",[],[30,49,70],{"collection":31,"item":32},"series",{"__typename":31,"title":25,"title_id":26,"slug":27,"children_series":33},[34,38,42,46],{"title":35,"title_id":36,"slug":37},"Artificial Intelligence","Kecerdasan Artifisial","kecerdasan-artifisial",{"title":39,"title_id":40,"slug":41},"Programming Fundamentals","Konsep Dasar Pemrograman","konsep-dasar-pemrograman",{"title":43,"title_id":44,"slug":45},"Algorithms and Data Structures","Algoritma dan Struktur Data","algoritma-struktur-data",{"title":47,"title_id":47,"slug":48},"LLM Systems","llm-systems",{"collection":31,"item":50},{"__typename":31,"title":51,"title_id":51,"slug":52,"children_series":53},"Tutorial","tutorial",[54,58,62,66],{"title":55,"title_id":56,"slug":57},"Learning Python","Belajar Python","belajar-python",{"title":59,"title_id":60,"slug":61},"Learning Go","Belajar Golang","belajar-golang",{"title":63,"title_id":64,"slug":65},"Learning Java","Belajar Java","belajar-java",{"title":67,"title_id":68,"slug":69},"Learning Pascal","Belajar Pascal","belajar-pascal",{"collection":31,"item":71},{"__typename":31,"title":72,"title_id":72,"slug":73,"children_series":74},"Lab","lab",[],{"article":76,"renderedBody":167,"renderedTakeaway":168,"latestArticles":169,"toc":257},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":90,"series":91,"authors":155,"seoTitle":21,"seoDescription":21,"body_locale":158,"available_locales":159,"body":161,"takeway":162,"prerequisite":163},163,"Pascal Capstone: Why Every Gradebook Score Came Back Zero","Capstone Pascal: Kenapa Semua Skor Buku Nilai Kembali Nol","pascal-gradebook-capstone","A gradebook reads three students from a file, prints three rows, and every score is 0. The procedure filled a copy of the array, because the parameter was missing `var`. Add the word and the report matches the file; the compiler had already warned about the call that filled nothing.","Sebuah buku nilai membaca tiga siswa dari berkas, mencetak tiga baris, dan setiap skornya 0. Prosedurnya mengisi salinan array, karena parameternya kehilangan `var`. Tambahkan kata itu dan laporannya cocok dengan berkasnya; kompilator sudah memperingatkan soal pemanggilan yang tidak mengisi apa pun.","2026-11-20T01:00:00.000Z",6,[86,87,88,89],"pascal","record","array","prosedur","\u002Fog\u002Fpascal-gradebook-capstone.png",{"id":92,"title":67,"title_id":68,"slug":69,"description":93,"description_id":94,"articles":95,"children_series":121,"parent_series":146},14,"Pascal is a humane language with a friendly syntax. It's easy to read and easy to write, which is why so many schools and universities still use it as a first language. Start here and take it one step at a time.","Pascal, bahasa pemrograman yang manusiawi dengan sintaksnya yang *friendly*. Dikenal karena kemudahan pemahaman dan implementasinya, Pascal banyak digunakan sebagai bahasa pemrograman dasar bagi para pelajar dan mahasiswa. Yuk mulai belajar Pascal bareng Inva!",[96,116],{"id":97,"title":98,"title_id":99,"slug":100,"excerpt":101,"excerpt_id":102,"has_translation":12,"published_at":103,"reading_time":104,"hidden_from_listing":15,"tags":105,"thumbnail_image":21,"og_image":107,"series":108,"authors":109},161,"Debugging Free Pascal with -gl and gdb","Men-debug Free Pascal dengan -gl dan gdb","pascal-debugging-fpc-gdb","A run with no prices ends at a hex address and status 217. `-gl` names the line, gdb names the values, and the mean of six positive prices comes out negative because `integer` is 2 bytes.","Jalan tanpa satu harga pun berakhir di alamat hex dan status 217. `-gl` menyebut barisnya, gdb menyebut nilainya, dan rata-rata dari enam harga positif keluar negatif karena `integer` berukuran 2 byte.","2026-11-18T01:00:00.000Z",7,[86,106],"debugging","\u002Fog\u002Fpascal-debugging-fpc-gdb.png",{"id":92,"title":67,"title_id":68,"slug":69},[110],{"authors_id":111},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},1,"Daffa Izzuddin","izzudd","Writer",{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":90,"series":117,"authors":118},{"id":92,"title":67,"title_id":68,"slug":69},[119],{"authors_id":120},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},[122,128,134,140],{"id":123,"title":124,"title_id":125,"slug":126,"description":127,"cover_image":21},23,"Getting Started with Pascal","Berkenalan dengan Bahasa Pascal","pascal-intro","Install Free Pascal on Windows or Linux, write Hello World, then learn how a Pascal program is put together, comments and arithmetic included.",{"id":129,"title":130,"title_id":131,"slug":132,"description":133,"cover_image":21},24,"Control Structures","Struktur Kontrol","pascal-struktur-kontrol","Boolean expressions, if-else and case-of branching, and the three kinds of loop Pascal gives you.",{"id":135,"title":136,"title_id":137,"slug":138,"description":139,"cover_image":21},25,"Composite Types","Tipe Data Bentukan","pascal-tipe-data-bentukan","Types you build yourself: record, array, and the pointer that keeps confusing everyone at first.",{"id":141,"title":142,"title_id":143,"slug":144,"description":145,"cover_image":21},26,"Procedural Programming","Pemrograman Prosedural","pascal-pemrograman-prosedural","Break a big program into small procedures and functions you can call again and again.",{"id":112,"title":51,"title_id":51,"slug":52,"parent_series":21,"children_series":147},[148,150,152,154],{"id":149,"title":55,"title_id":56,"slug":57,"cover_image":21},10,{"id":151,"title":59,"title_id":60,"slug":61,"cover_image":21},11,{"id":153,"title":63,"title_id":64,"slug":65,"cover_image":21},13,{"id":92,"title":67,"title_id":68,"slug":69,"cover_image":21},[156],{"authors_id":157},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},"en",[158,160],"id","\n`nilai.txt` holds three students and their scores. The report prints three rows and every score is 0, then an average of 0.00. The program exits with status 0, so nothing flags a problem.\n\n## The report that prints zeros\n\nSave the data as `nilai.txt`: one student per line, name and score separated by a semicolon.\n\n```text\nandi;78\nbudi;92\ncitra;65\n```\n\nThe starter is `nilai.pas`. It defines a record for one student and an array type for the class. `muat` fills the array from the file and `lapor` prints it.\n\n```pascal\nprogram nilai;\n\ntype\n  siswa = record\n    nama: string[20];\n    skor: integer;\n  end;\n  daftar = array[1..20] of siswa;\n\nvar\n  data: daftar;\n  jumlah: integer;\n\nprocedure muat(data: daftar; var jumlah: integer);\nvar\n  f: text;\n  baris: string;\n  pemisah, kode: integer;\nbegin\n  jumlah := 0;\n  assign(f, 'nilai.txt');\n  reset(f);\n  while not eof(f) do\n  begin\n    readln(f, baris);\n    pemisah := pos(';', baris);\n    jumlah := jumlah + 1;\n    data[jumlah].nama := copy(baris, 1, pemisah - 1);\n    val(copy(baris, pemisah + 1, length(baris)), data[jumlah].skor, kode);\n  end;\n  close(f);\nend;\n\nprocedure lapor(data: daftar; jumlah: integer);\nvar\n  i, total: integer;\nbegin\n  total := 0;\n  for i := 1 to jumlah do\n  begin\n    writeln(data[i].nama, ' ', data[i].skor);\n    total := total + data[i].skor;\n  end;\n  writeln('rata-rata ', (total \u002F jumlah):0:2);\nend;\n\nbegin\n  muat(data, jumlah);\n  lapor(data, jumlah);\nend.\n```\n\nThe command below writes the data file, then compiles. `-B` rebuilds even when an old binary is lying around, and `-vw` keeps the compile quiet except for warnings.\n\n```plain\n$ printf 'andi;78\\nbudi;92\\ncitra;65\\n' > nilai.txt && fpc -B -vw nilai.pas\nnilai.pas(48,12) Warning: Variable \"data\" does not seem to be initialized\n```\n\n`nilai.pas(48,12)` names line 48, the call `muat(data, jumlah)`, which is supposed to fill the array. The compiler can see that the array passed there never gets a value back.\n\n## The checker\n\n`check_nilai.pas` reads the program's output from the pipe, one line at a time, and compares line `i` with `harap[i]`. Those are the four lines the file should produce: three students and the average. A matching line prints `PASS`. A different line prints `FAIL` with the expected text and the text it got. Output with more than four lines, or fewer, fails too. The last line reports how many of the four passed, and `ExitCode` is set to 1 when any failed.\n\n```pascal\nprogram check_nilai;\n\nvar\n  harap: array[1..4] of string = ('andi 78', 'budi 92', 'citra 65', 'rata-rata 78.33');\n  baris: string;\n  i, gagal: integer;\n\nbegin\n  i := 0;\n  gagal := 0;\n  while not eof(input) do\n  begin\n    readln(baris);\n    i := i + 1;\n    if i > 4 then\n    begin\n      writeln('FAIL  baris ', i, ': keluaran lebih panjang dari yang diharapkan');\n      gagal := gagal + 1;\n    end\n    else if baris = harap[i] then\n      writeln('PASS  baris ', i, ': ', baris)\n    else\n    begin\n      writeln('FAIL  baris ', i, ': harap \"', harap[i], '\", dapat \"', baris, '\"');\n      gagal := gagal + 1;\n    end;\n  end;\n  if i \u003C 4 then\n  begin\n    writeln('FAIL  cuma ', i, ' baris, seharusnya 4');\n    gagal := gagal + 1;\n  end;\n  writeln(4 - gagal, ' of 4 checks passed');\n  if gagal > 0 then\n    ExitCode := 1;\nend.\n```\n\nThe starter fails all four lines.\n\n```plain\n$ fpc -vw check_nilai.pas && .\u002Fnilai | .\u002Fcheck_nilai\nFAIL  baris 1: harap \"andi 78\", dapat \" 0\"\nFAIL  baris 2: harap \"budi 92\", dapat \" 0\"\nFAIL  baris 3: harap \"citra 65\", dapat \" 0\"\nFAIL  baris 4: harap \"rata-rata 78.33\", dapat \"rata-rata 0.00\"\n0 of 4 checks passed\n```\n\n## A copy went in, a copy came out\n\n`procedure muat(data: daftar; var jumlah: integer)` has `var` on `jumlah` and no `var` on `data`. A parameter without `var` is passed by value, which in Pascal means the procedure gets its own copy of the array. It fills that copy with the three students, closes the file, and returns. The copy is discarded when `muat` returns.\n\n`jumlah` did come back, because it carries `var`. That is why `lapor` prints three rows: the count is real and the rows behind it are empty. Each row prints an empty name and a zero score, which shows up as ` 0` with a leading space. With every score at 0, the total is 0 and the average prints as `0.00`. Meanwhile the `data` in the main program was never written to, which is exactly what the warning said.\n\n## One word on the parameter\n\nPut `var` in front of `data` in `muat`. The procedure now receives the caller's array instead of a copy of it.\n\n```pascal\nprogram nilai;\n\ntype\n  siswa = record\n    nama: string[20];\n    skor: integer;\n  end;\n  daftar = array[1..20] of siswa;\n\nvar\n  data: daftar;\n  jumlah: integer;\n\nprocedure muat(var data: daftar; var jumlah: integer);\nvar\n  f: text;\n  baris: string;\n  pemisah, kode: integer;\nbegin\n  jumlah := 0;\n  assign(f, 'nilai.txt');\n  reset(f);\n  while not eof(f) do\n  begin\n    readln(f, baris);\n    pemisah := pos(';', baris);\n    jumlah := jumlah + 1;\n    data[jumlah].nama := copy(baris, 1, pemisah - 1);\n    val(copy(baris, pemisah + 1, length(baris)), data[jumlah].skor, kode);\n  end;\n  close(f);\nend;\n\nprocedure lapor(data: daftar; jumlah: integer);\nvar\n  i, total: integer;\nbegin\n  total := 0;\n  for i := 1 to jumlah do\n  begin\n    writeln(data[i].nama, ' ', data[i].skor);\n    total := total + data[i].skor;\n  end;\n  writeln('rata-rata ', (total \u002F jumlah):0:2);\nend;\n\nbegin\n  muat(data, jumlah);\n  lapor(data, jumlah);\nend.\n```\n\nThe warning is gone and the checker passes. Every line matches, so the checker never sets `ExitCode` to 1 and prints `4 of 4 checks passed`.\n\n```plain\n$ fpc -B -vw nilai.pas && .\u002Fnilai | .\u002Fcheck_nilai\nPASS  baris 1: andi 78\nPASS  baris 2: budi 92\nPASS  baris 3: citra 65\nPASS  baris 4: rata-rata 78.33\n4 of 4 checks passed\n```\n\n`lapor` still takes `data` without `var`, and that is correct. It only reads the array, so working on a copy changes nothing it prints.\n\n## When the average prints in scientific notation\n\nDelete the `:0:2` from the `writeln` in `lapor` and run the checker again. The first three lines still pass and the fourth fails with `rata-rata  7.8333333333333329E+001`. A `real` printed without a format string goes out in scientific notation, and it keeps a second space after the label. The checker catches this because it compares whole lines, and `rata-rata 78.33` is not that line.\n\n`:0:2` means no minimum width and two decimals. The integer scores need no field at all, because an integer already prints without decimals.\n\n## When the file is missing\n\nMove `nilai.txt` aside and run the program. `reset` on a file that is not there stops the program with `Runtime error 2` and exit status 2, before any row is printed. The lines under that error are addresses inside your own binary.\n\nThe capstone does not handle a missing file, because the file is the input the program was written for. When `fpc` warns that a variable does not seem to be initialized, check the line it names first: a procedure that needs to fill a parameter requires `var`.\n","- A procedure parameter without `var` is a copy, so filling the array inside the procedure leaves the caller's array empty and the report prints zeros.\n- The program still exits with status 0, and `fpc` warns `Variable \"data\" does not seem to be initialized` at the call that was supposed to fill it.\n- `var` on the parameter hands the procedure the caller's array, so the records it fills survive the call.\n- `reset`, `eof` and `readln` read the file, and `:0:2` is what turns the average into `78.33` instead of `7.8333333333333329E+001`.",{"id":164,"title":165,"slug":166},78,"Using and Writing a PROCEDURE in Pascal","penggunaan-dan-penulisan-procedure-pada-pascal","\u003Cp>\u003Ccode>nilai.txt\u003C\u002Fcode> holds three students and their scores. The report prints three rows and every score is 0, then an average of 0.00. The program exits with status 0, so nothing flags a problem.\u003C\u002Fp>\n\u003Ch2 id=\"the-report-that-prints-zeros\">The report that prints zeros\u003C\u002Fh2>\n\u003Cp>Save the data as \u003Ccode>nilai.txt\u003C\u002Fcode>: one student per line, name and score separated by a semicolon.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"andi%3B78%0Abudi%3B92%0Acitra%3B65\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>andi;78\nbudi;92\ncitra;65\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The starter is \u003Ccode>nilai.pas\u003C\u002Fcode>. It defines a record for one student and an array type for the class. \u003Ccode>muat\u003C\u002Fcode> fills the array from the file and \u003Ccode>lapor\u003C\u002Fcode> prints it.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PASCAL\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"program%20nilai%3B%0A%0Atype%0A%20%20siswa%20%3D%20record%0A%20%20%20%20nama%3A%20string%5B20%5D%3B%0A%20%20%20%20skor%3A%20integer%3B%0A%20%20end%3B%0A%20%20daftar%20%3D%20array%5B1..20%5D%20of%20siswa%3B%0A%0Avar%0A%20%20data%3A%20daftar%3B%0A%20%20jumlah%3A%20integer%3B%0A%0Aprocedure%20muat(data%3A%20daftar%3B%20var%20jumlah%3A%20integer)%3B%0Avar%0A%20%20f%3A%20text%3B%0A%20%20baris%3A%20string%3B%0A%20%20pemisah%2C%20kode%3A%20integer%3B%0Abegin%0A%20%20jumlah%20%3A%3D%200%3B%0A%20%20assign(f%2C%20'nilai.txt')%3B%0A%20%20reset(f)%3B%0A%20%20while%20not%20eof(f)%20do%0A%20%20begin%0A%20%20%20%20readln(f%2C%20baris)%3B%0A%20%20%20%20pemisah%20%3A%3D%20pos('%3B'%2C%20baris)%3B%0A%20%20%20%20jumlah%20%3A%3D%20jumlah%20%2B%201%3B%0A%20%20%20%20data%5Bjumlah%5D.nama%20%3A%3D%20copy(baris%2C%201%2C%20pemisah%20-%201)%3B%0A%20%20%20%20val(copy(baris%2C%20pemisah%20%2B%201%2C%20length(baris))%2C%20data%5Bjumlah%5D.skor%2C%20kode)%3B%0A%20%20end%3B%0A%20%20close(f)%3B%0Aend%3B%0A%0Aprocedure%20lapor(data%3A%20daftar%3B%20jumlah%3A%20integer)%3B%0Avar%0A%20%20i%2C%20total%3A%20integer%3B%0Abegin%0A%20%20total%20%3A%3D%200%3B%0A%20%20for%20i%20%3A%3D%201%20to%20jumlah%20do%0A%20%20begin%0A%20%20%20%20writeln(data%5Bi%5D.nama%2C%20'%20'%2C%20data%5Bi%5D.skor)%3B%0A%20%20%20%20total%20%3A%3D%20total%20%2B%20data%5Bi%5D.skor%3B%0A%20%20end%3B%0A%20%20writeln('rata-rata%20'%2C%20(total%20%2F%20jumlah)%3A0%3A2)%3B%0Aend%3B%0A%0Abegin%0A%20%20muat(data%2C%20jumlah)%3B%0A%20%20lapor(data%2C%20jumlah)%3B%0Aend.\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>program nilai;\n\ntype\n  siswa = record\n    nama: string[20];\n    skor: integer;\n  end;\n  daftar = array[1..20] of siswa;\n\nvar\n  data: daftar;\n  jumlah: integer;\n\nprocedure muat(data: daftar; var jumlah: integer);\nvar\n  f: text;\n  baris: string;\n  pemisah, kode: integer;\nbegin\n  jumlah := 0;\n  assign(f, 'nilai.txt');\n  reset(f);\n  while not eof(f) do\n  begin\n    readln(f, baris);\n    pemisah := pos(';', baris);\n    jumlah := jumlah + 1;\n    data[jumlah].nama := copy(baris, 1, pemisah - 1);\n    val(copy(baris, pemisah + 1, length(baris)), data[jumlah].skor, kode);\n  end;\n  close(f);\nend;\n\nprocedure lapor(data: daftar; jumlah: integer);\nvar\n  i, total: integer;\nbegin\n  total := 0;\n  for i := 1 to jumlah do\n  begin\n    writeln(data[i].nama, ' ', data[i].skor);\n    total := total + data[i].skor;\n  end;\n  writeln('rata-rata ', (total \u002F jumlah):0:2);\nend;\n\nbegin\n  muat(data, jumlah);\n  lapor(data, jumlah);\nend.\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The command below writes the data file, then compiles. \u003Ccode>-B\u003C\u002Fcode> rebuilds even when an old binary is lying around, and \u003Ccode>-vw\u003C\u002Fcode> keeps the compile quiet except for warnings.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20printf%20'andi%3B78%5Cnbudi%3B92%5Cncitra%3B65%5Cn'%20%3E%20nilai.txt%20%26%26%20fpc%20-B%20-vw%20nilai.pas%0Anilai.pas(48%2C12)%20Warning%3A%20Variable%20%22data%22%20does%20not%20seem%20to%20be%20initialized\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ printf 'andi;78\\nbudi;92\\ncitra;65\\n' &gt; nilai.txt &amp;&amp; fpc -B -vw nilai.pas\u003C\u002Fspan>\nnilai.pas(48,12) Warning: Variable \"data\" does not seem to be initialized\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>\u003Ccode>nilai.pas(48,12)\u003C\u002Fcode> names line 48, the call \u003Ccode>muat(data, jumlah)\u003C\u002Fcode>, which is supposed to fill the array. The compiler can see that the array passed there never gets a value back.\u003C\u002Fp>\n\u003Ch2 id=\"the-checker\">The checker\u003C\u002Fh2>\n\u003Cp>\u003Ccode>check_nilai.pas\u003C\u002Fcode> reads the program&#39;s output from the pipe, one line at a time, and compares line \u003Ccode>i\u003C\u002Fcode> with \u003Ccode>harap[i]\u003C\u002Fcode>. Those are the four lines the file should produce: three students and the average. A matching line prints \u003Ccode>PASS\u003C\u002Fcode>. A different line prints \u003Ccode>FAIL\u003C\u002Fcode> with the expected text and the text it got. Output with more than four lines, or fewer, fails too. The last line reports how many of the four passed, and \u003Ccode>ExitCode\u003C\u002Fcode> is set to 1 when any failed.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PASCAL\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"program%20check_nilai%3B%0A%0Avar%0A%20%20harap%3A%20array%5B1..4%5D%20of%20string%20%3D%20('andi%2078'%2C%20'budi%2092'%2C%20'citra%2065'%2C%20'rata-rata%2078.33')%3B%0A%20%20baris%3A%20string%3B%0A%20%20i%2C%20gagal%3A%20integer%3B%0A%0Abegin%0A%20%20i%20%3A%3D%200%3B%0A%20%20gagal%20%3A%3D%200%3B%0A%20%20while%20not%20eof(input)%20do%0A%20%20begin%0A%20%20%20%20readln(baris)%3B%0A%20%20%20%20i%20%3A%3D%20i%20%2B%201%3B%0A%20%20%20%20if%20i%20%3E%204%20then%0A%20%20%20%20begin%0A%20%20%20%20%20%20writeln('FAIL%20%20baris%20'%2C%20i%2C%20'%3A%20keluaran%20lebih%20panjang%20dari%20yang%20diharapkan')%3B%0A%20%20%20%20%20%20gagal%20%3A%3D%20gagal%20%2B%201%3B%0A%20%20%20%20end%0A%20%20%20%20else%20if%20baris%20%3D%20harap%5Bi%5D%20then%0A%20%20%20%20%20%20writeln('PASS%20%20baris%20'%2C%20i%2C%20'%3A%20'%2C%20baris)%0A%20%20%20%20else%0A%20%20%20%20begin%0A%20%20%20%20%20%20writeln('FAIL%20%20baris%20'%2C%20i%2C%20'%3A%20harap%20%22'%2C%20harap%5Bi%5D%2C%20'%22%2C%20dapat%20%22'%2C%20baris%2C%20'%22')%3B%0A%20%20%20%20%20%20gagal%20%3A%3D%20gagal%20%2B%201%3B%0A%20%20%20%20end%3B%0A%20%20end%3B%0A%20%20if%20i%20%3C%204%20then%0A%20%20begin%0A%20%20%20%20writeln('FAIL%20%20cuma%20'%2C%20i%2C%20'%20baris%2C%20seharusnya%204')%3B%0A%20%20%20%20gagal%20%3A%3D%20gagal%20%2B%201%3B%0A%20%20end%3B%0A%20%20writeln(4%20-%20gagal%2C%20'%20of%204%20checks%20passed')%3B%0A%20%20if%20gagal%20%3E%200%20then%0A%20%20%20%20ExitCode%20%3A%3D%201%3B%0Aend.\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>program check_nilai;\n\nvar\n  harap: array[1..4] of string = ('andi 78', 'budi 92', 'citra 65', 'rata-rata 78.33');\n  baris: string;\n  i, gagal: integer;\n\nbegin\n  i := 0;\n  gagal := 0;\n  while not eof(input) do\n  begin\n    readln(baris);\n    i := i + 1;\n    if i &gt; 4 then\n    begin\n      writeln('FAIL  baris ', i, ': keluaran lebih panjang dari yang diharapkan');\n      gagal := gagal + 1;\n    end\n    else if baris = harap[i] then\n      writeln('PASS  baris ', i, ': ', baris)\n    else\n    begin\n      writeln('FAIL  baris ', i, ': harap \"', harap[i], '\", dapat \"', baris, '\"');\n      gagal := gagal + 1;\n    end;\n  end;\n  if i &lt; 4 then\n  begin\n    writeln('FAIL  cuma ', i, ' baris, seharusnya 4');\n    gagal := gagal + 1;\n  end;\n  writeln(4 - gagal, ' of 4 checks passed');\n  if gagal &gt; 0 then\n    ExitCode := 1;\nend.\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The starter fails all four lines.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20fpc%20-vw%20check_nilai.pas%20%26%26%20.%2Fnilai%20%7C%20.%2Fcheck_nilai%0AFAIL%20%20baris%201%3A%20harap%20%22andi%2078%22%2C%20dapat%20%22%200%22%0AFAIL%20%20baris%202%3A%20harap%20%22budi%2092%22%2C%20dapat%20%22%200%22%0AFAIL%20%20baris%203%3A%20harap%20%22citra%2065%22%2C%20dapat%20%22%200%22%0AFAIL%20%20baris%204%3A%20harap%20%22rata-rata%2078.33%22%2C%20dapat%20%22rata-rata%200.00%22%0A0%20of%204%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ fpc -vw check_nilai.pas &amp;&amp; .\u002Fnilai | .\u002Fcheck_nilai\u003C\u002Fspan>\nFAIL  baris 1: harap \"andi 78\", dapat \" 0\"\nFAIL  baris 2: harap \"budi 92\", dapat \" 0\"\nFAIL  baris 3: harap \"citra 65\", dapat \" 0\"\nFAIL  baris 4: harap \"rata-rata 78.33\", dapat \"rata-rata 0.00\"\n0 of 4 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Ch2 id=\"a-copy-went-in-a-copy-came-out\">A copy went in, a copy came out\u003C\u002Fh2>\n\u003Cp>\u003Ccode>procedure muat(data: daftar; var jumlah: integer)\u003C\u002Fcode> has \u003Ccode>var\u003C\u002Fcode> on \u003Ccode>jumlah\u003C\u002Fcode> and no \u003Ccode>var\u003C\u002Fcode> on \u003Ccode>data\u003C\u002Fcode>. A parameter without \u003Ccode>var\u003C\u002Fcode> is passed by value, which in Pascal means the procedure gets its own copy of the array. It fills that copy with the three students, closes the file, and returns. The copy is discarded when \u003Ccode>muat\u003C\u002Fcode> returns.\u003C\u002Fp>\n\u003Cp>\u003Ccode>jumlah\u003C\u002Fcode> did come back, because it carries \u003Ccode>var\u003C\u002Fcode>. That is why \u003Ccode>lapor\u003C\u002Fcode> prints three rows: the count is real and the rows behind it are empty. Each row prints an empty name and a zero score, which shows up as \u003Ccode> 0\u003C\u002Fcode> with a leading space. With every score at 0, the total is 0 and the average prints as \u003Ccode>0.00\u003C\u002Fcode>. Meanwhile the \u003Ccode>data\u003C\u002Fcode> in the main program was never written to, which is exactly what the warning said.\u003C\u002Fp>\n\u003Ch2 id=\"one-word-on-the-parameter\">One word on the parameter\u003C\u002Fh2>\n\u003Cp>Put \u003Ccode>var\u003C\u002Fcode> in front of \u003Ccode>data\u003C\u002Fcode> in \u003Ccode>muat\u003C\u002Fcode>. The procedure now receives the caller&#39;s array instead of a copy of it.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PASCAL\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"program%20nilai%3B%0A%0Atype%0A%20%20siswa%20%3D%20record%0A%20%20%20%20nama%3A%20string%5B20%5D%3B%0A%20%20%20%20skor%3A%20integer%3B%0A%20%20end%3B%0A%20%20daftar%20%3D%20array%5B1..20%5D%20of%20siswa%3B%0A%0Avar%0A%20%20data%3A%20daftar%3B%0A%20%20jumlah%3A%20integer%3B%0A%0Aprocedure%20muat(var%20data%3A%20daftar%3B%20var%20jumlah%3A%20integer)%3B%0Avar%0A%20%20f%3A%20text%3B%0A%20%20baris%3A%20string%3B%0A%20%20pemisah%2C%20kode%3A%20integer%3B%0Abegin%0A%20%20jumlah%20%3A%3D%200%3B%0A%20%20assign(f%2C%20'nilai.txt')%3B%0A%20%20reset(f)%3B%0A%20%20while%20not%20eof(f)%20do%0A%20%20begin%0A%20%20%20%20readln(f%2C%20baris)%3B%0A%20%20%20%20pemisah%20%3A%3D%20pos('%3B'%2C%20baris)%3B%0A%20%20%20%20jumlah%20%3A%3D%20jumlah%20%2B%201%3B%0A%20%20%20%20data%5Bjumlah%5D.nama%20%3A%3D%20copy(baris%2C%201%2C%20pemisah%20-%201)%3B%0A%20%20%20%20val(copy(baris%2C%20pemisah%20%2B%201%2C%20length(baris))%2C%20data%5Bjumlah%5D.skor%2C%20kode)%3B%0A%20%20end%3B%0A%20%20close(f)%3B%0Aend%3B%0A%0Aprocedure%20lapor(data%3A%20daftar%3B%20jumlah%3A%20integer)%3B%0Avar%0A%20%20i%2C%20total%3A%20integer%3B%0Abegin%0A%20%20total%20%3A%3D%200%3B%0A%20%20for%20i%20%3A%3D%201%20to%20jumlah%20do%0A%20%20begin%0A%20%20%20%20writeln(data%5Bi%5D.nama%2C%20'%20'%2C%20data%5Bi%5D.skor)%3B%0A%20%20%20%20total%20%3A%3D%20total%20%2B%20data%5Bi%5D.skor%3B%0A%20%20end%3B%0A%20%20writeln('rata-rata%20'%2C%20(total%20%2F%20jumlah)%3A0%3A2)%3B%0Aend%3B%0A%0Abegin%0A%20%20muat(data%2C%20jumlah)%3B%0A%20%20lapor(data%2C%20jumlah)%3B%0Aend.\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>program nilai;\n\ntype\n  siswa = record\n    nama: string[20];\n    skor: integer;\n  end;\n  daftar = array[1..20] of siswa;\n\nvar\n  data: daftar;\n  jumlah: integer;\n\nprocedure muat(var data: daftar; var jumlah: integer);\nvar\n  f: text;\n  baris: string;\n  pemisah, kode: integer;\nbegin\n  jumlah := 0;\n  assign(f, 'nilai.txt');\n  reset(f);\n  while not eof(f) do\n  begin\n    readln(f, baris);\n    pemisah := pos(';', baris);\n    jumlah := jumlah + 1;\n    data[jumlah].nama := copy(baris, 1, pemisah - 1);\n    val(copy(baris, pemisah + 1, length(baris)), data[jumlah].skor, kode);\n  end;\n  close(f);\nend;\n\nprocedure lapor(data: daftar; jumlah: integer);\nvar\n  i, total: integer;\nbegin\n  total := 0;\n  for i := 1 to jumlah do\n  begin\n    writeln(data[i].nama, ' ', data[i].skor);\n    total := total + data[i].skor;\n  end;\n  writeln('rata-rata ', (total \u002F jumlah):0:2);\nend;\n\nbegin\n  muat(data, jumlah);\n  lapor(data, jumlah);\nend.\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The warning is gone and the checker passes. Every line matches, so the checker never sets \u003Ccode>ExitCode\u003C\u002Fcode> to 1 and prints \u003Ccode>4 of 4 checks passed\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20fpc%20-B%20-vw%20nilai.pas%20%26%26%20.%2Fnilai%20%7C%20.%2Fcheck_nilai%0APASS%20%20baris%201%3A%20andi%2078%0APASS%20%20baris%202%3A%20budi%2092%0APASS%20%20baris%203%3A%20citra%2065%0APASS%20%20baris%204%3A%20rata-rata%2078.33%0A4%20of%204%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ fpc -B -vw nilai.pas &amp;&amp; .\u002Fnilai | .\u002Fcheck_nilai\u003C\u002Fspan>\nPASS  baris 1: andi 78\nPASS  baris 2: budi 92\nPASS  baris 3: citra 65\nPASS  baris 4: rata-rata 78.33\n4 of 4 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>\u003Ccode>lapor\u003C\u002Fcode> still takes \u003Ccode>data\u003C\u002Fcode> without \u003Ccode>var\u003C\u002Fcode>, and that is correct. It only reads the array, so working on a copy changes nothing it prints.\u003C\u002Fp>\n\u003Ch2 id=\"when-the-average-prints-in-scientific-notation\">When the average prints in scientific notation\u003C\u002Fh2>\n\u003Cp>Delete the \u003Ccode>:0:2\u003C\u002Fcode> from the \u003Ccode>writeln\u003C\u002Fcode> in \u003Ccode>lapor\u003C\u002Fcode> and run the checker again. The first three lines still pass and the fourth fails with \u003Ccode>rata-rata  7.8333333333333329E+001\u003C\u002Fcode>. A \u003Ccode>real\u003C\u002Fcode> printed without a format string goes out in scientific notation, and it keeps a second space after the label. The checker catches this because it compares whole lines, and \u003Ccode>rata-rata 78.33\u003C\u002Fcode> is not that line.\u003C\u002Fp>\n\u003Cp>\u003Ccode>:0:2\u003C\u002Fcode> means no minimum width and two decimals. The integer scores need no field at all, because an integer already prints without decimals.\u003C\u002Fp>\n\u003Ch2 id=\"when-the-file-is-missing\">When the file is missing\u003C\u002Fh2>\n\u003Cp>Move \u003Ccode>nilai.txt\u003C\u002Fcode> aside and run the program. \u003Ccode>reset\u003C\u002Fcode> on a file that is not there stops the program with \u003Ccode>Runtime error 2\u003C\u002Fcode> and exit status 2, before any row is printed. The lines under that error are addresses inside your own binary.\u003C\u002Fp>\n\u003Cp>The capstone does not handle a missing file, because the file is the input the program was written for. When \u003Ccode>fpc\u003C\u002Fcode> warns that a variable does not seem to be initialized, check the line it names first: a procedure that needs to fill a parameter requires \u003Ccode>var\u003C\u002Fcode>.\u003C\u002Fp>\n","\u003Cul>\n\u003Cli>A procedure parameter without \u003Ccode>var\u003C\u002Fcode> is a copy, so filling the array inside the procedure leaves the caller&#39;s array empty and the report prints zeros.\u003C\u002Fli>\n\u003Cli>The program still exits with status 0, and \u003Ccode>fpc\u003C\u002Fcode> warns \u003Ccode>Variable &quot;data&quot; does not seem to be initialized\u003C\u002Fcode> at the call that was supposed to fill it.\u003C\u002Fli>\n\u003Cli>\u003Ccode>var\u003C\u002Fcode> on the parameter hands the procedure the caller&#39;s array, so the records it fills survive the call.\u003C\u002Fli>\n\u003Cli>\u003Ccode>reset\u003C\u002Fcode>, \u003Ccode>eof\u003C\u002Fcode> and \u003Ccode>readln\u003C\u002Fcode> read the file, and \u003Ccode>:0:2\u003C\u002Fcode> is what turns the average into \u003Ccode>78.33\u003C\u002Fcode> instead of \u003Ccode>7.8333333333333329E+001\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n",[170,188,210,215,232,252],{"id":171,"title":172,"title_id":173,"slug":174,"excerpt":175,"excerpt_id":176,"has_translation":12,"published_at":177,"reading_time":178,"hidden_from_listing":15,"tags":179,"thumbnail_image":21,"og_image":183,"series":184,"authors":185},164,"Python Capstone: Why a Blank CSV Field Cut the Class Average","Python Capstone: Kenapa Satu Kolom CSV Kosong Memotong Rata-rata Kelas","python-capstone-gradebook","A gradebook reads four students and writes a JSON report. The class average says 52.42, because two empty fields became zeros.","Buku nilai membaca empat siswa dan menulis laporan JSON. Rata-rata kelasnya bilang 52.42, karena dua kolom kosong berubah jadi nol.","2026-11-21T01:00:00.000Z",8,[180,181,182],"python","input-output","cli","\u002Fog\u002Fpython-capstone-gradebook.png",{"id":149,"title":55,"title_id":56,"slug":57},[186],{"authors_id":187},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},{"id":189,"title":190,"title_id":191,"slug":192,"excerpt":193,"excerpt_id":194,"has_translation":12,"published_at":177,"reading_time":195,"hidden_from_listing":15,"tags":196,"thumbnail_image":21,"og_image":201,"series":202,"authors":207},48,"What a Linked List Actually Is","Tentang Struktur Data LinkedList","tentang-struktur-data-linked-list","A linked list is a linear chain of nodes, each holding data and a pointer to the next node. Here is what that chain looks like, what it costs next to an array, and the same minimal implementation in Java, Python, and JavaScript.","Linked list adalah rantai linear berisi node, dan setiap node menyimpan data plus pointer ke node berikutnya. Ini bentuk rantainya, ongkosnya dibanding array, dan implementasi paling sederhana dalam Java, Python, serta JavaScript.",4,[197,198,199,200],"struktur-data","linked-list","pointer","konsep","\u002Fog\u002Ftentang-struktur-data-linked-list.png",{"id":203,"title":204,"title_id":205,"slug":206},28,"Linear Data Structures","Struktur Data Linear","asd-struktur-linear",[208],{"authors_id":209},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":90,"series":211,"authors":212},{"id":92,"title":67,"title_id":68,"slug":69},[213],{"authors_id":214},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},{"id":216,"title":217,"title_id":218,"slug":219,"excerpt":220,"excerpt_id":221,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":222,"thumbnail_image":21,"og_image":223,"series":224,"authors":229},162,"Python File I\u002FO: Why the Second Read Came Back Empty","Python File I\u002FO: Kenapa Pembacaan Kedua Kembali Kosong","python-file-read-write","A notes script saves a line, prints it back, then counts zero. The file on disk is correct: `read()` left the pointer at the end, so the second call returned an empty string. Read once into a variable, or `seek(0)`, and the count matches the file.","Skrip catatan menyimpan satu baris, mencetaknya kembali, lalu menghitung nol. Berkas di disk sudah benar: `read()` meninggalkan pointer di ujung, jadi panggilan kedua mengembalikan string kosong. Baca sekali ke sebuah variabel, atau `seek(0)`, dan hitungannya cocok dengan berkas.",[180,181],"\u002Fog\u002Fpython-file-read-write.png",{"id":225,"title":226,"title_id":227,"slug":228},18,"Working with Python Scripts","Menggunakan Script Python","python-pemrograman-dengan-script",[230],{"authors_id":231},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},{"id":233,"title":234,"title_id":235,"slug":236,"excerpt":237,"excerpt_id":238,"has_translation":12,"published_at":239,"reading_time":104,"hidden_from_listing":15,"tags":240,"thumbnail_image":21,"og_image":243,"series":244,"authors":249},47,"Why Understanding Algorithms and Data Structures Actually Matters","Pentingnya Memahami Algoritma dan Struktur Data","pentingnya-memahami-algoritma-dan-struktur-data","An algorithm is an ordered list of steps, and that order decides how expensive a problem is. The examples are on the back of an instant noodle packet, in a factorial, and behind ctrl+z.","Sebagai konsep fundamental, algoritma menentukan seberapa mahal sebuah masalah diselesaikan. Contohnya ada di bungkus mie instan, di bilangan faktorial, dan di tombol undo.","2026-11-19T01:00:00.000Z",[241,197,200,242],"algoritma","dasar","\u002Fog\u002Fpentingnya-memahami-algoritma-dan-struktur-data.png",{"id":245,"title":246,"title_id":247,"slug":248},27,"About Algorithms and Data Structures","Tentang Algoritma dan Struktur Data","asd-intro",[250],{"authors_id":251},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},{"id":97,"title":98,"title_id":99,"slug":100,"excerpt":101,"excerpt_id":102,"has_translation":12,"published_at":103,"reading_time":104,"hidden_from_listing":15,"tags":105,"thumbnail_image":21,"og_image":107,"series":253,"authors":254},{"id":92,"title":67,"title_id":68,"slug":69},[255],{"authors_id":256},{"id":112,"name":113,"slug":114,"role":115,"profile_picture":21},[258,262,265,268,271,274],{"text":259,"depth":260,"id":261},"The report that prints zeros",2,"the-report-that-prints-zeros",{"text":263,"depth":260,"id":264},"The checker","the-checker",{"text":266,"depth":260,"id":267},"A copy went in, a copy came out","a-copy-went-in-a-copy-came-out",{"text":269,"depth":260,"id":270},"One word on the parameter","one-word-on-the-parameter",{"text":272,"depth":260,"id":273},"When the average prints in scientific notation","when-the-average-prints-in-scientific-notation",{"text":275,"depth":260,"id":276},"When the file is missing","when-the-file-is-missing",1795825297520]