pembuatan fungsi dasar

Beranda › Forums › Belajar Flutter Mobile Apps Tingkat Pemula › pembuatan fungsi dasar

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #48374
    Endi Murdiono
    Participant

      mohon bimbingannya coach. saat awal2 latihan pembuatan fungsi ada sedikit yg mengganggu/belum berhasil.

      1. void cetakTambah({int angka1, int angka2}){
      2. print(angka1+angka2);
      3. }

      #error#
      line 1.the parameter ‘angka1’ can’t have a value of ‘null’ because of its type, but the implicit default is ‘null’.
      try adding either an explicit non-‘null’ default value or the ‘required’ modifier.
      #error#
      line 1.then parameter ‘angka2’ can’t have …isi error sama dng diatas.

      saat variable fungsi tidak dikasih kurungkurawal, aman. saat coba ditambah kurungkurawal, jadi error.

      #48460
      Anonymous

        Bisa diberikan angka diawal seperti
        1. void cetakTambah({int angka1 = 0, int angka2 = 0}){
        2. print(angka1+angka2);
        3. }

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.
      Shopping cart0
      There are no products in the cart!
      Continue shopping