Salon Ba Da Umarnin Gina Manhaja (Statements & Syntax)

Salon Ba Da Umarni (Statements and Syntax)

Bayan bayanai kan waye maginin manhaja, da meye ayyukansa, kuma da wasu abubuwa yake gudanar da ayyukansa, lokaci yayi yanzu don fahimtar ta yaya maginin manhaja ke baiwa kwamfuta umarni har ta aiwatar?  Idan mai karatu bai mance ba, a baya mun zayyana cewa daga cikin aikin maginin manhaja akwai rubuta umarni ga kwamfuta, wanda a harshen turancin sadarwa ake kira: “Coding.”  Wannan aiki na dauke ne da manyan rukunnai guda biyu.

 

Rukunin farko shi ne “Salon Ba Da Umarni,” wanda wannan sashi zai mayar da hankali a kai.  Wannan shi ake kira: “Statements and Syntax.”  “Statements” su ne zallar umarnin da ake baiwa kwamfuta don ta zartar.  Mai karatu zai ga misalai cikin bayanan dake tafe in Allah ya so.  A daya bangaren kuma, “Syntax” su ne salon da ake ba da umarnin dashi.  Kowane yaren gina manhajar kwamfuta (Programming Language) yana da nashi tsarin bayar da umarni da kuma salon yin hakan.  Fahimtar hakan yana da matukar mahimmanci ga dalibin dake koyon gina manhajar kwamfuta.

 

Rukuni na biyu kuma shi ne, yin amfani da “Mazubin Bayanai” wajen adana bayanai.  Salon ba da umarni a ilimin gina manhaja yana yiwuwa ne ta hanyar wasu isharori.  Ga takaitattun bayanai kan shahararru daga cikinsu:

 

Isharar Zuba Bayanai Cikin Mazubi ( = )

Kowane umarni da ake baiwa kwamfuta na dauke ne da bayanan manhaja (program data) wadanda ke dauke cikin mazubi (Variables).  A tsakaninsu akwai ishara da ake amfani da ita don hada alaka tsakanin bayanan da mazubin.  Wannan ishara kuwa ita ce: =  (wato alamar daidaito kenan a fannin lissafi).  Misali, idan kana son zuba wasu lambobi cikin wani mazubi ta amfani da yaren JavaScript, sai kace:

var mazubi_1 = 32;

var mazubi_2 = 23;

var jimilla = mazubi_1 + mazubi_2;

alert(jimilla);

A layin farko na zuba lambar 32 cikin mazubi mai suna: “mazubi_1”, a layi na biyu na zuba lambar 23 cikin mazubi mai suna: “mazubi_2”, a layi na uku kuma na zuba wadancan mazubai biyun farko ne cikin mazubi mai suna: “jimilla,” inda na tara adadin dake cikin mazubin faro da mazubi na biyu.  Sannan a karshe umarci kwamfuta ta nuna mini jimillar adadin duka, ta amfani da salon ba da umarni mai suna: “alert()” a yaren JavaScript.  Kalmar “var” dake farkon kowane layi alama ce da ake rubuta ta don nuna cewa kalmar dake bayanta “mazubi” ce, wato: “Variable” kenan.   Kowane yaren gina manhaja yana da nasa salon.

 

Isharar Tarawa ( + )

Wannan ishara ita ce isharar da ake amfani da ita wajen hada adadin wasu lambobi guda biyu a fannin lissafi.  Alamar kuwa ita ce: ( + ), wato: “Plus Sign” a ilimin lissafi.  Idan muka dubi misalin da na kawo a sama, mai karatu zai ga wannan ishara ce nayi amfani da ita tsakanin mazubi na farko da na biyu, don na hade su cikin mazubi mai suna: “Jimilla”, don samun jimillar lambobin biyu.  Ga karin misali nan a yaren Python, cikin sauki:

jimilla = 324 + 4343
print(jimilla)

 

A layin farko na zuba lambobi biyu ne cikin mazubi daya mai suna “jimilla”, sannan na umarni kwamfuta da ta bani jimillar wadannan lambobi biyu, ta amfani da salon ba da umarni mai suna: “Print()” a yaren Python.

 

Isharar Debewa ( – )

Wannan ishara ana amfani da ita ne wajen rage wani adadi daga wani adadi na lambobi ko kididdiga.  Alamar kuwa ita ce: ( – ), wato: “Minus Sign” a harshen turancin lissafi.  Ga aikinta nan a yaren JavaScript, cikin sauki:

var babanSadik = 2000 – 1000;

console.log(babanSadik);

Layin farko na dauke ne da mazubi mai suna: “babanSadik” wanda na zuba adadin 2000 da 1000, tare da debe 1000 daga 2000.  A karshe kuma na umarci kwamfuta ta nuna mini jimillar lissafin ta amfani da salon ba da umarni mai suna: “console.log()” na yaren JavaScript.

 

 Isharar Rabawa ( /, //, % )

Wannan ishara ana amfani da ita ne wajen raba wani adadi na lissafi ga wasu adadi na  yawa.  Ita ce isharar da ake kira: “Division Sign” a fannin lissafi.  Duk da cewa mun saba da ishara mai kama: ( ÷ ) sai dai a ilimin gina manhajar kwamfuta ba a amfani da wannan ishara wajen rabawa.  Ana amfani ne da alamar: / ko // ko kuma %.

Isharar farko ( / ) tana raba wani adadi ne na yawa ga wani adadi na mutane ko abubuwa daidai wa daida.  Ishara ta biyu ( // ) kuma tana raba wani adadi ne na yawa, sannan ta bayyana yawan shigan adadin.  Misali, idan kana son gane sau nawa lambar 3 za ta iya shiga lambar 9?  A yaren Python, sai kace:

yawanShiga = 9 // 3

print(yawanShiga)

Da zarar ka umarci kwamfuta za ta bayyana mana 3.  Wannan shi ne amfanin wannan ishara, wato bayyana sau nawa wani adadi ke shiga wata lamba.  Wannan ishara ba kowane yaren gina manhajar kwamfuta ke amfani da ita ba.  Sai ishara ta uku ( % ), wacce ake kira “Modulus”, aikinta shi ne bayyana ragowar wani adadi da aka raba wa wasu lambobi na mutane ko abubuwa.

 

Isharar Rubanyawa ko Ninkawa ( * )

Wannan ishara aikinta shi ne ninkawa ko rubanya wani adadi da wani adadi na lamba.  A fannin lissafi mun saba da isharar: ( x ), don nufin rubanyawa.  A ilimin gina manhajar kwamfuta ba ruwanmu da wannan ita.  Ana amfani ne da isharar tauraro, wato: “Star” ko kace: “Asterisk,” a ilimin kwamfuta.  A yaren JavaScript  idan kana son rubanya wani adadi da wani adadi, abu ne mai sauki, wai cire wando ta ka.  Kawai kace:

var rubanyawa = 32 * 43;

console.log(rubanyawa);

Kana baiwa kwamfuta umarni nan take za ta maido maka 1376 a matsayin amsa.

Baban Sadik

Baban Sadik marubuci ne, kuma mai bincike a fannin kimiyya da fasahar sadarwar zamani da tasirinsu ga al'umma a kasashen Afrika, musamman Najeriya. Ya tanadi wannan shafi ne don taskance dukkan kasidun da yake gabatarwa a shafinsa na jaridar AMINIYA mai take: "Kimiyya da Kere-kere," wanda ya faro tun shekarar 2006; shekaru goma kenan a takaice. Bayan kasidun shafin jarida, wannan shafi har wa yau yana dauke da wasu kasidun da ya gabatar a tarurruka da aka gayyace shi, ko wasu hirarraki da gidan rediyon BBC Hausa yayi dashi a lokuta daban-daban. Baban Sadik na zaune ne a birnin tarayyar Najeriya, wato Abuja.

One thought on “Salon Ba Da Umarnin Gina Manhaja (Statements & Syntax)

  • August 3, 2017 at 6:43 pm
    Permalink

    Allah ya saka da alkhairi ya Kara hazaka

    Jazakallahu khairan

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *