Shonascript Learn

Download as pdf or txt
Download as pdf or txt
You are on page 1of 76

Docusaurus v2

Table of contents:
ShonaScript Chii?
Zvii zvinodiwa?
Tanga Pano
STEP 1: Node JS
STEP 2: VS Code
STEP3: Gadzira Folder "shonascript"
Step 4: ShonaScript
Ma Variables
Variable Chii?
Manyorerwo ema variables
Unoona sei kuti variable yako yadzirwa?
Nyora
Nyora Chii?
Mashandisirwo a nyora()
Zvinobvumidzwa muna nyora()
Kupa nyora() zvakawanda
Enzaniso
Enzaniso chii?
Mashandisirwo e enzaniso
Kana, Zvimwe
Kana/Zvimwe chii?
Mashandisirwo a Kana na Zvimwe
Unoshanda kuzvitupa
Ma list
Ma list chii?
Manyorerwo e list
Mashandisirwo e list
Muenzaniso: Vanhu mu kombi
Kuverenga zvinhu zviri mu list
Kuisa zvinhu mu list
Kubvisa zvinhu mu list
Kutora chinhu kubva mu list
Kupinda mu list
Kutsvaga chinhu mu list
Kujamba chinhu mu list
Kubuda mulist
Mashoko
Mashoko chii?
Kutsemura Mashoko
Kutsemura Mavara mumashoko
Kubatanidza mashoko
Maths
Maths ne ShonaScript
Nhamba.chero()
Gadzira Gemhu (Game)
Nguva ne Zuva
Nguva
Zuva
Ma Functions
Ma function chii?
Basa ne ma variable
Basa re Maths
Basa rinoshanda ne nguva
Mirira _ seconds
Dzokorora _ seconds
Kushandisa misaBasa.
Mhinduro
Waakushanda kuzvitupa zvekare
Ma Objects
ShonaScript to JavaScript
ShonaScript to Python
On this page

ShonaScript Chii?
NOT YET REVISED

ShonaScript i programming language inokubatsira kuti udzidzire kunyora code ne shona, kana usati
wambonyora code zvachose.

TSANANGURO
programming language - i language inonzwisiswa ne computer

code - ma words, ma numbers, kana ma special characters akaita se ma brackets aya "{},()"
anoshandiswa mu programming language

shona - i language inoshandiswa ne mamwe ma Zimbabweans pakutaura

Zvii zvinodiwa?
Kuti ugone kutanga kunyora code ne ShonaScript, panodiwa:

1. Computer 💻 - yekunyorera code


2. Internet 🌍 - inongodiwa pakudownloader ma files nezvimwe zvaunozoshandisa

Tanga Pano
Teedzera masteps aya anodiwa kuti ugone kushandisa ShonaScript . Kana uchida kubatsirwa,
unokurudzirwa kutaura mugroup re whatsapp

STEP 1: Node JS
DOWNLOAD NODE JS
Unofana kudownloader software inonzi Node JS kana usati wamboidownloader. Node JS inogona
kukura zve 55MB

1. Enda ku https://nodejs.org/en/download/, wo downloader Node JS inoenderana ne computer


yaunoshandisa. Unoona paine windows , kana macOS

Unogona kuona video riripazasi apa kana uchikwanisa. Video iri harina kugadzirwa nesu, asi kana
usiri kunzwisisa zvikuitika, bvunza mu group re whatsapp

2. Kana uchishandisa Windows unoenda mu command prompt , kana uchishandisa


macOS unoenda mu terminal :

i. Enda mu command prompt / terminal


ii. Nyora kuti node -v
unofana kuona nhamba inotanga na "v" sokuti v16.13.1
kana usiri kuona nhamba iyi, unogona kuvhara command prompt / terminal , oivhura oedza
zvekare kuti node -v
kana usati waakuona nhamba , zvinoreva kuti hauna kugadzira NodeJS zvakanaka, saka
taura mu group rewhatsapp, ubatsirwe.
3. Paku installer Node JS , chingobaya continue kana next kusvika waaku installer. Usachinje
chinhu.

STEP 2: VS Code
Uchashandisa VS Code kunyora code yako. Usashandise imwe editor kunze kwe VS Code , nekuti VS
Code ndiyo inokwanisa kuona ShonaScript .

DOWNLOAD VS CODE
VS Code inogona kukura zve 171MB

1. Enda ku https://code.visualstudio.com/, wo downloader VS Code inoenderana ne computer


yaunoshandisa

Unogona kuona video iri kana uchikwanisa:


STEP3: Gadzira Folder "shonascript"
GADZIRA FOLDER RESHONASCRIPT
1. Enda mudesktop folder mako, ogadzira folder rakanzi shonascript
2. Vhura VS Code, woenda pamusoro pakanzi file

chienda pakanzi Open Folder , wotsvaga folder rako rawagadzira mu desktop rakanzi
shonascript

3. Kana pakabuda pakanzi do you trust the authors , unoti yes


Step 4: ShonaScript
TIP
1. mu VS Code , enda pama extensions :

Onyora mu search box kuti ShonaScript , unofana kuona ShonaScript semu picture iri
pamusoro apa. Wa downloader inonzi syntax highlighter apa.

2. vhura terminal mu VS Code

Unofana kuona terminal pasi pescreen rako


3. Mu terminal :

nyora kuti npm i shona -g , wobaya enter


kana ukaona mu terminal makanzi npm ERR , ne red , edza kunyora: sudo npm i
shona -g , wobaya enter
chinonzi shona ndicho chinokubatsira kugadzira mafiles anodiwa

4. Mu terminal :

nyora kuti shona hesi wobaya enter


unofana kuona izvi mu terminal :
5. Ukatarisa mu folder rako rawagadzira riya mu VS Code , unofana kuona kuti ShonaScript
yagadzira mafiles 4:

index.shona - ndomauchanyora code


index.js - usanyore chinhu umu
shona.js - usanyore chinhu umu

package.json - usanyore chinhu umu

6. Mu terminal zvekare, nyora kuti npm i shonascript , wobaya enter

Unofana kuona mu folder rako rave ne zvinhu izvi:


folder rakanzi node_modules , usaribate
file rimwe rakanzi package_lock.json , usaribate

7. Chipinda mu file rakanzi index.shona , unofana kuona pazasi mu VS Code makanzi


Shonascript seizvi:

izvi ndizvo zvinoreva kuti waakukwanisa kushandisa ShonaScript

8. Mu index.shona , dzima line 1 wonyora kuti nyora("Goodluck Zimbabwe") pa line 1


ipapo

9. Mu terminal , nyora kuti node shona.js , wobaya enter . Unofana kusaona ma line e red
mu terminal kana code yako ichishanda.

10. Mu terminal , nyora kuti node index.js , wobaya enter . Unofana kuona mu terminal
imomo makanzi Goodluck Zimbabwe .

Makorokoto 🎉 , wanyora code yako yekutanga ne ShonaScript


Chienda kumberi udzidze kuti code yemu ShonaScript inonyorwa sei

Edit this page


On this page

Ma Variables
NOT YET REVISED

Variable Chii?
Kuti unzwisise kuti ma variables chii, ndichapa muenzaniso we hembe yaunofarira . Ngatimboti iwewe une
hembe yaunofarira, hembe iyoyo ndeye red . Iwewe ukuda kutuma mumwe munhu asingazive
nezvehembe dzako kunotora hembe yaunofarira kwayakarongedzwa. Ukangoudza munhu uyu, kuti “enda
kunotora hembe yandofarira”, munhu uyu achakubvunza kuti hembe yaunofarira yakaita sei, nekuti
akaenda kunoitsvaga iye asingaizive haamboiwane.

TSANANGURO

Uchishandisa muenzaniso uyu, munhu wauri kutuma i computer .

Iwewe ndiwe munhu ari kuda kunyora code ne Shonascript kunotsvaga hembe yaunofarira .

Variable apa i hembe yaunofarira , hembe yaunofarira yacho “ndeye red”

Manyorerwo ema variables


Saka unotaura sei ne computer nezve hembe yaunofarira ? Unofana kunyora code inotaura ne
computer seizvi:

Image Here
Image Here

Chii chikuitika apa? 🤯


NGATIMBOTARISA KU LEFT KWE EQUAL SIGN (=).
Tanyora ma words 2 epa hembe yandinofarira akabatana kuita hembeYandinofarira .
Manyorero aya anonzi lower camel casing . Unogona kuverenga nezvayo pano. Kana tichinyora
ma variables, ku left kwemabrackets kunoiswa word one rakabatanidzwa. Izvi ndizvo zvinonzwisiswa
ne computer . Unogona kubatanidza ma words aye kuita hembe_yandinofarira kana kuti
HembeYandinofarira kana kuti hembeyandinofarira .

Ukaisa ma words 2 kuti hembe yandinofarira = "ndeye red" , computer ichafunga kuti ukuedza
kunyora two ma variables hembe na yandinofarira panguva imwe chete, saka inokuudza kuti
manyorero awaita hembe yandinofarira haasiriwo . Tarisa mamwe manyorero asinganzwisiswe
ne computer mu box re red pazasi

MANYORERO EKULEFT SIDE ASINGAITE

hembe yandinofarira = "ndeye red" -> ku left kunofana kuenda one word

1hembeYandinofarira = "ndeye red" -> usatange zita re variable ne number kana !@#$%^&*

hembe-yandinofarira = "ndeye red" -> usaise hyphen(-) muzita re variable , asi unogona
kushandisa underscore () kubatanidza ma _words kuita one sezvambotaurwa

MANYORERO EKULEFT SIDE ANOITA

hembeYandinofarira = "ndeye red"


HembeYandinofarira = "ndeye red"

hembe_yandinofarira = "ndeye red"

NGATICHITARISA KU RIGHT KWE EQUAL SIGN (=)

Chekutanga, unoona kuti pane ma quotes (""). Zvinhu zvese zviri mu ma quotes zvinoverengwa ne
computer se chinhu chimwe chete, semashoko, uye zvinoverengwa sezvazviri. Ukasaisa ma quotes
ukati hembeYandinofarira = ndeye red , computer ichatarisa kuti chinhu chiri kuright kwe equal
sign (=) ichiedza kuda kuona kuti:

1. i nhamba here? - haisi


2. imwe code ine zvainoreva zvinozivikanwa ne Shonascript here? - haisi
code ine zvainoreva iri kutaurwa apa uchazoiziva kumberi ukaramba uchiverenga

Saka kana computer yaona kuti ku right hakuna zvinhu izvi, ichaona sokuti zvese zviri kuright i
variable . Asi ku right kune 2 mashoko aisira muma quotes, saka ichaona kunge urikuda kunyora 2
ma variables panguva imwe chete yokuudza kuti manyorero awaita haasiriwo . Asi kana
kuright kwacho kuine word rimwe chete, sokuti hembeYandinofarira = red , computer ichaona kuti
waisa variable ku right , yoedza kutsvaga kuti variable inonzi red yambogadzirwa here mu
code yako.

Kugadzira variable kuita sei?

Kugadzira variable ndiko kuti zitaReVariable = "zvimwe zvinhu" zvakafanana nekuti


hambeYandinofarira = "ndeye red" . Apa panenge pachigadzirwa variable inonzi
hembeYandinofarira

Kana computer ikashaya variable inonzi red yairi kutsvaga, inonyora kuti variable inonzi
red haisi kuzivikanwa .

Unoona sei kuti variable yako yadzirwa?


KUNYORA UCHISHANDISA NYORA()
Pane anonzi ma functions, auchazoziva pauchaverenga nezve topic yema functions. Munhu
anoshandisa ma functions kana achida kutuma computer kuti iite basa . Shonascript ine function
inoita basa rekunyora zvaukuda kuona inonzi nyora() . Enda kumberi kana uchida kuona kuti
nyora() anoshanda sei. Izvi zvichakubatsira kunzwisisa mashandiro ema variables .

Edit this page


On this page

Nyora
NOT REVISED YET

Nyora Chii?
Nyora i function yaunotuma kuita basa rekunyora zvinhu mu terminal . Unozonzwisisa zvema
function kana waverenga nezvawo kumberi, asi panguva ino chimbongoziva kuti ma function anoita
basa raanenge atumwa.

Mashandisirwo a nyora()
Image here

Image here

Chii chikuitika apa? 🤯


Nyora anotumwa zvekunyora zvacho zviri muma brackets (). Tichatarisa line rimwe ne rimwe tichiedza
kunzwisisa kuti zvii zvikuitika. Ma line atiri kutaura ndiwo ariku left mu picture iri pamusoro apa

TSANANGURO
Line 1

nyora("Hesi")
Apa nyora() apihwa mashoko ekunyora, mashoko acho ndi "Hesi". "Hesi" apa anotariswa ne
computer semashoko nekuti akaiswa mumaquotes "". Kana computer ichinge yatumwa kunyora
mashoko, inongonyora mashoko sezvaari. Saka Ukateedzera ma steps aya wega:

ITA

1. mu file rakanzi index.shona , nyora kuti nyora("Hesi")


2. mu terminal nyora kuti node shona.js , wobaya enter
3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ukaita masteps aya zvakanaka, unofana kuona muterminal makanyorwa kuti

Hesi

Kana ukaona izvi, wagona kushandisa nyora()

TSANANGURO
Line 2

nyora(2021)

Apa nyora apihwa nhamba yekunyora. Nhamba yacho ndi 2021 .

Computer inozvinona sei kuti inhamba? Ko sei usina kuisa


ma quotes kuti `nyora("2021")`?

Computer inozviona kuti i nhamba kana iri nhamba chaiyo isina kuiswa muma quotes "" .
Uchazonzwisisa tsananguro yema quotes ukaramba uchiverenga. Panguva ino dzokorora ma steps 3
ambotaurwa mu box re green pamusoro pana Ita, asi nyora kuti nyora(2021) panzvimbo ya
nyora("Hesi") . Unofana kuona mu terminal makanzi:

2021

Line 4 na Line 5
zitaRangu = "Panashe"
nyora(zitaRangu)

Apa tatanga nekugadzira variable . Kana usati waakunzwisisa kuti variable chii, unogona
kuverenga nezvawo kumashure kune topic yema variable . Variable yagadzirwa apa ndi
zitaRangu , ichibva yanzi ndi "Panashe" . Unogona kubvisa pakanzi "Panashe" , oisa zita rako riri
muma quotes. Usasiye maquotes, nekuti hazvishande.

Izvi zvinoreva kuti tikazotuma computer kunotsvaga variable inonzi zitaRangu , inofana kudzoka
na "Panashe" . Saka pa line 5 , takuudza computer kuti nyora(zitaRangu) , ichaona kuti
nyora() uye apihwa zvekunyora, asi zvekunyora zvacho hazvisi kuma quotes, saka haasi mashoko .
Computer ichatarisa kuti kana asiri mashoko, saka i nhamba here? Kwete.

Saka zvaakureva kuti nyora apihwa variable . Variable ichatsvagwa kumashure kuti
wamboigadzira here. Saka apa, hongu, waigadzira zitaRangu = "Panashe" pa line 4 . Ukaita
ma steps 3 aye ari mu box rakanzi Ita pamusoro apa, unofana kuona mu terminal makanzi:

Panashe

Bvisa pakanzi "Panashe" uise zita rako 😂


Line 7

Sekutsanangurwa kwaitwa pana line 4 na line 5 , apa nyora() apihwa zvekunyora, asi
zvekunyora zvacho i variable . Computer ichatsvaga variable inonzi zitaRake kumusoro kwe
code yako, yobva yaishaya. Saka ukada kudzokorora ma steps 3 aye ekumashure uku, uchona kuti
pauchanyora mu terminal kuti node shona.js , uchanzi:

Paita problem, `zitaRake` haasi kuzivikanwa paline 7

Zvinobvumidzwa muna nyora()


Saka zvii zvinobvumidzwa muma bracket a nyora() .

ZVINOBVUMIDZWA MUMA BRACKETS


1. mashoko

zvinhu zvese zvaiswa muma quotes chero zvisingareve chinhu zvinotariswa ne computer se
mashoko saka zvinongonyorwa zvakadaro

2. nhamba

nhamba inonyorwa iri one. Kuti nyora(20 21) hazviite nekuti 20 na 21 atove ma nhamba
akasiyana ari 2. Uchazoona pazasi kuti kana uchida kunyora zvinhu zvakawanda uye zvakasiyana
siyana muma brackets a nyora() unoita sei

3. ma variables

kana usati waakunzwisisa kuti ma varibles chii, enda kumashure kune topic yema varables kuti
ugonzwisisa

Kupa nyora() zvakawanda

Ko kana uchida kuti nyora() anyore zvakawanda, unoita sei?

Kunyora zvakawanda kwatiri kutaura apa ndiko kutuma nyora() kuti anyore zvakawana panguva imwe
chete. Ngatimboti iwewe ukuda kuti nyora() anyore ma nhamba 2. Manhamba acho ndi 2021 na 2022,
unonyora sei?

Image here

Image here

Chii chikuitika apa? 🤯


TSANANGURO
Kana uchida kuti nyora() anyore zvakawanda, unoisa ma comma, pakati pezvinhu zvacho
zvaukuda kuti anyore;

Line 1

nyora(2021,2022)

Apa, nyora() apihwa zvinhu 2; nhamba 2021 na nhamba 2022. Pakati pema nhamba aya pane ma
comma , zvichireva kuti ukuudza computer kuti 2021 na 2022 ma nhamba akasiyana.

Ukasaisa comma , Ukanyora kuti

nyora(2021 2022)

Computer ichatadza kunzwisisa kuti 2021 2022 chii, nekuti haisi nhamba , mashoko , kana
variable . Saka ichakuudza kuti paita problem

Line 2 na Line 3

Apa tatanga nekugadzira variable inonzi zitaRangu . Saka pa line 5 , ukupa nyora() zvinhu 2:

1. mashoko ekuti "Inini ndinonzi "


2. variable inonzi zitaRangu . Ukaita ma steps 3 aye ekumashure emu terminal , unoona mu
terminal makanzi:

Inini ndinonzi Panashe

Tumira message kuwhatsapp kana ku facebook kana uchida kubatsirwa.

Edit this page


On this page

Enzaniso
Enzaniso chii?
NOT YET REVISED

Enzaniso dzinoshandiswa kana uchida ku enzanisa ma variables 2. Ngatomboti une 2


ma variables awagadzira kare variableYekutanga na variableYechipiri . Kana uchishandisa
enzaniso , unenge uchitora variable yekutanga, oi enzanisa ne imwe variable . Pane enzaniso
dzemhando 3.

Apa, unogona kutora variableYekutanga uchida kuona zvinhu 3 izvi:

MHANDO YEENZANISO
1. Yakafanana na variableYechipiri here?
2. Idiki pane variableYechipiri here?
3. Ihombe kudarika/kupfuura variableYechipiri here?

Mashandisirwo e enzaniso
Mashandisirwo chaiwo e enzaniso uchazomaoona kana waverenga topic ye Kana, Zvimwe . Asi
panguva ino unogona kumboona zvinoitika panenge pachishandiswa enzaniso .

Image here
Chii chikuitika apa? 🤯
TSANANGURO
Line 1 na Line 2

variableYekutanga = 5
variableYechipiri = 6

Tatanga nekugadzira ma variable 2: variableYekutanga na variableYechipiri . Ndiwo ma


variable atiri kuda kuzo enzanisa

Line 4 na Line 5

zvakafananaHere = variableYekutanga yakafanana na variableYechipiri


nyora(zvakafananaHere)

Apa tiri kuda kuona kuti variableYekutanga yakafanana na variableYechipiri here, saka
tashandisa yakafanana na . Ukaenzanisa ma variable aya, unofana kuona kuti akaenzana here
kana kuti kwete.

ko nyora() arikutsvagei pa line 5

pa line 4 tanga tichienzanisa variableYekutanga na variableYechipiri , pakuenzanisa


kwatiri kuita, tinogona kuona kuti ichokwadi kana kuti kunyepa . Kuti iwewe ugone kuzoona kuti chii
chaitiki pataenzanisa, uchashandisa nyora() .

Tagadzira variable inonzi zvakafananaHere tichibva taita kuti variable iyoyo iite zvinhu
zvichabuda pakuenzanisa ma variableYekutanga na variableYechipiri . Tinoita izvi nekuti
tikuda kuzonyora variable iyoyo tione kuti chii chaitika pataenzanisa.
Chiita izvi wega unone zvinoitika

ITA
1. mu file rakanzi index.shona nyora:

variableYekutanga = 5
variableYechipiri = 6
zvakafananaHere = variableYekutanga akafanana na variableYechipiri
nyora(zvakafananaHere)

2. mu terminal nyora kuti node shona.js , wobaya enter


3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ukaita masteps aya zvakanaka, unofana kuona mu terminal makanzi

false

Zvichireva kuti kunyepa . Ukatarisawo variableYekutanga ndi 5, na variableYechipiri ndi 6


havana kuenzana saka zvechokwadi kuti 5 akafanana na 6 kunyepa.

TSANANGURO
Line 7 na Line 8

Matsanangurirwo aitwa pa line 4 na line 5 akafanana ne matsanangurirwo epa line 7 na line 8. Asi
changochinja ndechekuti tiri kuda kuona kuti variableYekutanga idiki here pana
variableYechipiri . Ukadzokorora masteps 3 arimu box re green rakanzi Ita, unofana kuona mu
terminal makanzi:

true

true zvireva kuti ichokwadi . Zvechokwadiwo variableYekutanga (5), idiki pane


variableYechipiri (6)

Line 10 na Line 11

Matsanangurirwo aitwa pa line 4 na line 5 akafanana ne matsanangurirwo epa line 7 na line 8. Asi
changochinja ndechekuti tiri kuda kuona kuti variableYekutanga ihombe here pana
variableYechipiri . Ukadzokorora masteps 3 arimu box re green rakanzi Ita, unofana kuona mu
terminal makanazi:

false

False zvireva kuti kunyepa. Zvechokwadi variableYekutanga (5), haasi muhombe pane
variableYechipiri (6)

Enzaniso dzinoshandiswa pakawanda wanda sezvauchazoona ukaramba uchiverenga

Edit this page


On this page

Kana, Zvimwe
NOT REVISED YET

Kana/Zvimwe chii?
Pane dzimwe nguva dzekuti iwewe unogona kuda kuudza computer kuti itarise uye ishandise chidimbu
che code mushure mekunge kana chimwe chinhu chiri chokwadi, ndopanoshanda kana . Kana chinhu
ichocho chisiri chokwadi , unenge uchiudza kuudza computer kuti ishandise imwe code isiri muma
brackets a kana . Code iyoyo inozoshandiswa inoiswa muma brackets a zvimwe

Kuti ugonzwisisa zvatiri kutaura pano, tichashandisa zvinhu izvi:

ZVATICHASHANDISA NA KANA/ZVIMWE
1. ma variable
2. enzaniso
3. nyora()

Kana usina kunzwisisa kuti ma variables ne enzaniso chii, unokurudzirwa kuverenga ma topic iwayo
zvekare, uyezve unogona kubvunza mu group re whatsapp kuti ubatsirike

Mashandisirwo a Kana na Zvimwe


Unoshanda kuzvitupa
WAPIHWA BASA KUZVITUPA (NATIONAL IDS)

Ngatimboti iwewe unoshanda kuzvitupa mu Zimbabwe. Mu Zimbabwe, munhu anobvumidzwa kutora


chitupa kana achinge asvitsa makore 16. Ngatomboti iwewe basa rako nderekubvunza makore emunhu
auya kuzotora chitupa. Kana munhu akati ane makore 16 zvichienda mberi, uchamuudza kuti aende ku
office kunotora chitupa, zvimwe uchamuudza kuti anozodzoka kana aane makore 16.

Iwewe semunhu aakugona kushandisa ShonaScript , ukuda kuita kuti munhu auya kuzotora chitupa
audzwe zvekuita ne computer . Saka uchanyora code inoita izvi uchiteedzera masteps ari pazasi apa.

RONGA
Step 1 : Kugadzira ma variables

Tiri kuda kuzoenzanisa zvinhu 2 izvi:

1. makore anobvumidzwa kuti munhu atore chitupa mu Zimbabwe


2. makore emunhu auya kuzotora chitupa

Saka zvawaona kuti tichada kuzoshandisa enzaniso , zvaakureva kuti tikufana kugadzira ma
variables 2 aya:

1. makoreAnobvumidzwa

Ndiyo variable yemakore anobvumidzwa kuti munhu atore chitupa (16 years)

2. makoreEMunhu

Ndiyo variable yemakore e munhu auya kuzotora chitupa. Pakutanga apa ngatimboti makore
emunhu auya kuzotora chitupa nhasi ane makore 15

Zvatapedza kuronga pa step 1, chinyora code yacho seizvi:

ITA
1. Pa line 1 mu index.shona , nyora kuti

makoreAnobvumidzwa = 16

2. Pa line 2 mu index.shona , nyora kuti

makoreEMunhu = 15

se izvi:
Image here

Ma nhamba ariku left ayo ndiwo ma nhamba emaline aunoona mu VS Code

USANYORE SE IZVI
Usagadzire variable yako uchiti: makoreAnobvumidzwa = 16 years

Izvi hazviite nekuti ukadzokora kunoverenga nezve ma variables , uchaona kuti computer
ichatarisa ku right side kwe equal sign (=) yobva yaona kuina 16 years . Zvichaitika ndeizvi:

1. 16 years haasi muma quotes, saka haasi mashoko .


2. 16 years haisi nhamba nekuti pane 16 na years
3. 16 years achaonekwa kunge variable , computer ichakuudza kuti manyorero awaita
variable iyoyo haasiriwo

Iwewe wanga ukuda kuenzanisa makore, saka makore i nhamba , zvichireva kuti paunogadzira ma
variable ako, unofana kuisa nhamba ku right side kwe equal sign.

Step 2: Kushandisa enzaniso na kana na zvimwe

ITA

1. Pa line 4 mu index.shona , nyora kuti:

kana makoreEMunhu iridiki pane makoreAnobvumidzwa {

2. pa line 5 mu index.shona , nyora kuti:


nyora("Uchiri mudiki, unozodzoka waane makore 16")

3. pa line 6 mu index.shona , nyora kuti:

} zvimwe {

4. pa line 7 mu index.shona , nyora kuti:

nyora("Enda ku Office kunotora chitupa")

5. pa line 8 mu index.shona , nyora kuti:

se izvi:

Image here

Hausi watyora shona here apa?

TSANANGURO
Kana enzaniso iyo iri chokwadi , tikuda kuti computer ishandise code iri muma curly brackets {}
ekutanga. Asi kana enzaniso isiri chokwadi tikuda kuti computer ishandise code iri muma curly
bracket echipiri anoteera zvimwe .

Tatyora Shona here?

Computer inonzwisisa kuti makoreEmunhu na makoreAnobvumidzwa ma variables . Saka


computer ichaverenga ichiti kana variable inonzi makoreEMunhu iridiki pane variable
inonzi makoreAnobvumidzwa

Kana wapedza kunyora code yako, chiona kuti mu terminal munonyorwa kuti chii. Zvekare kuti unoita izvi
kana uchida kuti code yako isande

ITA
1. mu index.shona , nyora code iri mu picture
2. mu terminal nyora kuti node shona.js , wobaya enter
3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ukaita izvi zvakanaka, unofana kuona mu terminal makanyorwa kuti:

Uchiri mudiki unozodzoka waane makore 16

Zvechokwadiwo makoreEMunhu anga ari 15 zvichireva kuti haasi aakukwanisa kutora chitupa.

ITA

Chiisa makore akawanda kudarika 16

1. mu index.shona , uchinje makoreEMunhu kuti aite 18 se izvi:

makoreEMunhu = 18

2. mu terminal nyora kuti node shona.js , wobaya enter


3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ikozvino unofana kuona mu terminal makanzi:


Enda ku Office kunotora chitupa

Edit this page


On this page

Ma list
NOT REVISED YET

Ma list chii?
Kana iwewe uchida kuenda kunotenga zvinhu zvakawanda, unogona kunyora zvinhu zvaukuda kunotenga
pa pepa kana mu phone . Kana uchinge waita izvi, tinoti wanyora list rezvaukuda kunotenga.

Ko computer inoona sei list

Manyorerwo e list
Computer inoziva kuti wanyora list kana ukanyora ma square brackets se izvi:

["Muvhuro", "Chipiri", "Chitatu"]

TSANANGURO
Apa ndagadzira list re mazuva 3 kubva pana Muvhuro kusvika pana Chitatu. Mu list
randagadzira iri, mune zvinhu 3. zvinhu izvi zvandaisa mu list aya mashoko ane ma quotes
akapatsanurwa ne ma comma, .

ZVII ZVINOBVUMIDZWA MU LIST?


1. Mashoko ane ma quotes

sokuti: ["Muvhuro","Chipiri","Chitatu"]
2. Ma nhamba

sokuti: [2020, 2021, 2022]

3. Ma variables

sokuti:

muvhuro = "Muvhuro"
chipiri = "Chipiri"
chitatu = "Chitatu"

[muvhuro, chipiri, chitatu]

Ukatarisa apa, ndaisa ma variable mu list , asi ndatanga ndamagadzira ma variable


iwayo se mashoko zvakanaka. Kana usina kuzvinzwisisa izvi, unofana kudzokera kunoverenga
nezve ma variables kumashure kune topic yema variables kuti zvii zvikuitika.

Mashandisirwo e list
Kazhinji munhu anogadzira list achida kuzorishandisa. Anogona kuda kudzima zvinhu mu list imomo,
kana kuwedzera zvimwe zvinhu. Kuti ugone kuzoshandisa list raunenge wagadzira, unofana kuripa zita.
Unopa list zita kunge uri kugadzira variable . Ngatimboti list randagadzira kumashure
["Muvhuro", "Chipiri", "Chitatu"] waakuda kuripa zita rekuti mazuva , unoita se izvi

mazuva = ["Muvhuro", "Chipiri", "Chitatu"]

ZITA RE LIST
Zita re list rinonyorwa semagadzirirwo evariable. Manyorero anoita ndeaya:

1. Zita ngariite shoko rimwe chete rakabatanidzwa

sokuti listRangu
usati list Rangu , nekuti aya mashoko maviri

2. Zita ngarisaite nhamba

sokuti 2021 = ["Muvhuro", "Chipiri", "Chitatu"]


Muenzaniso: Vanhu mu kombi
Ngatimboti iwewe uri hwindi akarongeka we kombi, arikukwidza vanhu mukombi asi achinyora list
remazita evanhu vapinda mukombi. Ngatimboti panguva ino mukombi maane vanhu 5, zita re list rako
rinonzi vanhuMukombi .

ITA
1. mu index.shona pa line 1 , nyora kuti:

vanhuMukombi = ["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]

2. mu index.shona pa line 2 , nyora kuti:

nyora(vanhuMukombi)

3. mu terminal , nyora kuti: node shona.js wobaya enter

4. mu terminal , nyora kuti: node index.js wobaya enter

Kana ukaita zivi zvakanaka, unofana kuona muterminal makanzi

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]

Izvi zvinoitika nekuti wagadzira list re vanhuMukombi zvakanaka, wobva wazoudza computer kuti inyore
list iri ichishandisa nyora(vanhuMukombi)

Kuverenga zvinhu zviri mu list


Kana uchida kuziva kuti mu list rako mune zvinhu zvingani, unoshandisa .zvingani() , .vangani() ,
kana .mangani() , se izvi:

vanhuMukombi.vangani()
Image here

Image here

ITA

1. nyora code iyi mu index.shona

2. mu terminal , nyora kuti: node shona.js wobaya enter

3. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi zvakanaka, unofana kuona mu terminal makanyorwa nhamba yezvinhu zviri mu
vanhuMukombi kuti:

TSANANGURO

Pa Line 2 :

tashandisa .vangani() pane vanhuMukombi kuti tiwane nhamba yevanhu vari mu list rako
tobva tagadzira variable inonzi x .
Tagadzira variable iyi nekuti tikuda kuzoinyora mu terminal tichishandisa nyora()

Kuisa zvinhu mu list


"Ruvarashe" auya kuzopinda mukombi, iwewe sa hwindi waakufana kuisa zita rake mu list
rawagadzira kare rinonzi vanhuMukombi . Tarisa pazasi kuti uonoita sei izvi:

ITA: "RUVARASHE" MU LIST

1. mu index.shona pa line 3 nyora kuti:

isa "Ruvarashe" mu vanhuMukombi

Kana kuti unogona kunyora:

1. mu index.shona pa line 3 nyora kuti:

vanhuMukombi.isa("Ruvarashe")

2. mu index.shona pa line 4 , nyora kuti:

nyora(vanhuMukombi)

3. mu terminal , nyora kuti: node shona.js wobaya enter

4. mu terminal , nyora kuti: node index.js wobaya enter

ukaita izvi zvakanaka, unofana kuona mu terminal makanzi:

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai", "Ruvarashe"]

Zvichireva kuti taisa zita ra "Ruvarashe" mu list redu zvakanaka, saka mukombi maane vanhu 6

Image here

Image here
Ukateedzera zviri mu picture iyi, unofana kuona mu terminal makanzi

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]


["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai","Ruvarashe","Tatenda"]

TSANANGURO
Izvi zvinoitika nekuti nyora() atumwa ka 2 kunyora mu terminal :

1. Atumwa kunyora usati waisa "Ruvarashe" na "Tatenda" mu list , saka pekutanga nyora
anongonyora list riine vanhu 5 chete
2. Pazotumwa nyora pa line 5 , "Ruvarashe" na "Tatenda" vanga vaiswa mu list , saka
nyora anobva anyora vanhu vese vari 7 kusanganisira "Tatenda" na "Ruvarashe"

Kubvisa zvinhu mu list


"Kudzai" asvika kwaanga achienda ne kombi, saka aakuburuka. Iwewe sa hwindi akarongeka, chibvisa
zita rake kubva mu list rako riye. Tarisa pazasi kuti uone kuti unoita sei

ITA: BVISA "KUDZAI" KUBVA MU LIST


1. mu index.shona pa line 6 nyora kuti:

bvisa "Kudzai" mu vanhuMukombi

Kana kuti unogona kunyora:

1. mu index.shona pa line 6 nyora kuti:

vanhuMukombi.bvisa("Kudzai")

2. mu index.shona pa line 7 , nyora kuti:


nyora(vanhuMukombi)

3. mu terminal , nyora kuti: node shona.js wobaya enter

4. mu terminal , nyora kuti: node index.js wobaya enter

Image here

Image here

Ukaita izvi zvakanaka, unofana kuona mu terminal kuti:

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]


["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai","Ruvarashe","Tatenda"]
["Panashe", "Tanaka", "Kupa", "Vimbai","Ruvarashe","Tatenda"]

TSANANGURO
1. nyora(vanhuMukombi) wepa line 2 ndiye anyora kuti:

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]

Apa hatisati taisa vanhu mukombi

2. nyora(vanhuMukombi) wepa line 5 ndiye anyora kuti:

["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai","Ruvarashe","Tatenda"]


Apa tanga taisa "Ruvarashe" na "Tatenda" mu list pa line 3 na line 4 . Taane vanhu 7

3. nyora(vanhuMukombi) wepa line 7 ndiye anyora kuti:

["Panashe", "Tanaka", "Kupa", "Vimbai","Ruvarashe","Tatenda"]

Apa tanga tabvisa "Kudzai" kubva mu list pa line 6 . Tasara ne vanhu 6

Kutora chinhu kubva mu list


Vanhu vari mukombi yako iyi vakagara pamasiti emukombi. Masiti aya ane ma nhamba . Vanhu
vanowanzotangira kuverenga ma nhamba pana 1 , asi computer inotangira pana 0 nguva dzese

COMPUTER INOTANGIRA PANA ZERO

Izvi zvakakosha kunzwisisa

Iwewe zvawaane vanhu 6 mukombi, uchati vanhu 6 ava vakagara pa masiti 6. Tarisa list rako iri:

vanhuMukombi = ["Panashe", "Tanaka", "Kupa", "Vimbai","Ruvarashe","Tatenda"]

IWEWE UNOVERENGA MASITI EVANHU SEIZVI

"Panashe" aripasiti 1
"Tanaka" aripasiti 2
"Kupa" aripasiti 3

"Vmbai" aripasiti 4
"Ruvarashe" aripasiti 5

"Tatenda" aripasiti 6

Asi computer ichatangira pana zero kwete pana 1 seizvi:

COMPUTER INOVERENGA MASITI EVANHU SEIZVI


"Panashe" aripasiti vanhuMukombi[0]
zvichireva kuti aripasiti rechi zero
"Tanaka" aripasiti vanhuMukombi[1]

"Kupa" aripasiti vanhuMukombi[2]


"Vmbai" aripasiti vanhuMukombi[3]
"Ruvarashe" aripasiti vanhuMukombi[4]

"Tatenda" aripasiti vanhuMukombi[5] Aya ndiwo matarisiro anoita computer zvinhu zviri
mu list . Unogona kutora chinhu mu list ogadzira variable kuti uone kuti chii chinoitika

ITA
1. mu index.shona , pazasi pe code yawambonyora, nyora kuti

munhu = vanhuMukombi[1]
nyora(munhu)

2. mu terminal , nyora kuti: node shona.js wobaya enter

3. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi zvakanaka, uchaona kuti nyora() wekupedzisira anonyora chinhu chiri pa nhamba 2 mu list
rako, kwete pekutanga, nekuti chinhu chekutanga chiri pa nhamba 0 kwete 1

Kupinda mu list
Iwewe sa hwindi ane hunhu, ukuda kumhoresa munhu mumwe nemumwe arimukombi yako nezita rake
nekuti unoziva mazita avo. Unoita sei? Tichaedza kuita izvi nenzira 2, asi wega uchazviona kuti ndezvipi
zvirinani.

NZIRA YEKUTANGA: SHANDISA NYORA PANE MU WESE ARI MULIST


1. mu index.shona dzima maline ese osiya line rekutanga rakanzi:

vanhuMukombi = ["Panashe", "Tanaka", "Kudzai", "Kupa", "Vimbai"]

chinyora pa line 2 kuti:

nyora("Hesi Panashe")
enda pa line 3 onyora kuti:

nyora("Hesi Tanaka")

enda pane line riri kutevera uchidzokorora kumhoresa munhu arimo sezvaitwa pa line 2 na line
3 , upedzisire pane line 6 . Tarisa picture iri pazasi kuti uone maitirwo azvo

nyora("Vimbai")

Image here

Image here

Ko kana mu list mangu muine vanhu 1000?

Kana mu list mako muine vanhu 1000, zvinoreva kuti kana uchida kuvamhoresa vese nenzira iyi, uchanyora
ma line 1000 mu index.shona uchimhoresa munhu mumwe ne mumwe.

Ma line 1000 aya akawandisa, hapana here imwe nzira inoita


kuti tinyore ma line mashoma mu code yedu?

NZIRA YECHIPIRI: KUPINDA MU LIST


Kunonzi kupinda mu list, zvinoreva kuti tanga pane chinhu chekutanga mu list otuma computer kuita
zvauri kuda, oenda pane chechipiri, zvichingodaro kusvika pane chekupedzisira.

Tiri kuda kutuma computer kupinda mulist. Unopinda sei? Chimbotarisa manyorero ataita pazasi:

Image here

Image here

Chii chikuitika pa line 2?

TSANANGURO: KUPINDA MU LIST

Tiri kuti pane ___ mu ___ { . Apa tine 2 ma ___

1. ___ wekutanga anomirira variable inopinda mu list

variable inopinda mu list inonyorwa semanyorerwo anoitwa ma variables akataurwa mu


topic yema variables . Asi apa kutongonyora variable yekuti munhu ndiko kutoigadzira
kwacho, saka computer inonzwisisa kuti apa wagadzira variable ichapinda mu list rako

2. ___ wechipiri anomirira zita re list rako raukuda kupinda mariri


3. Ma curly brackets {} anoudza computer kuti kana yapinda mulist, ishandise code irimo muma
curly brackets aya

Ko pana Line 3?

Line 3 arimuma curly brackets saka zvinoreva kuti computer ichasandisa code iyi kana ichinge
yapinda mu list rako re vanhuMukombi .

nyora("Hesi ", munhu)


Apa nyora() apihwa zvekunyora zviri 2: "Hesi " na munhu .

1. "Hesi " arimuma quotes, zvichireva kuti mashoko saka computer inonzwisisa kuti "Hesi "
achanyorwa mu terminal sezvaari
2. munhu haasi mu ma quotes, zvichireva kuti haasi mashoko , uye haisi nhamba , saka computer
inonzwisisa kuti munhu i variable

computer ichatsvaga kuti variable inonzi munhu inopinda mu list yambogadzirwa here?
Hongu, yagadzirwa pa line 3

Kana computer yapinda mu list

Kana computer yapinda mu list rako, inotanga pane chinhu chekutanga mulist rako. Saka apa
inotanga pana "Panashe" . Kana computer iri pana "Panashe" , variable inonzi munhu ichachinja
kuita "Panashe" .

munhu = "Panashe"

Computer paichashandisa line 3

nyora("Hesi ", munhu)

Apa munhu ndi "Panashe" , saka mu terminal muchanyorawa kuti Hesi Panashe .

Kana computer yapedza kushandisa code iri muma curly brackets {} pana "Panashe" , ichaenda
pane chinhu chiri kutevera mu list rako yoita sezvayaita pana "Panashe" . Saka variable munhu
ichachinja kuita munhu = "Tanaka" yonyora nyora("Hesi ",munhu) , zvichingodaro kusvika
yapedza nevanhu vese vari mulist rako

Kutsvaga chinhu mu list


Unogona kutsvaga chinhu mu list uchishandisa .muna() , kana kuti irimu . Ngatimboti iwewe ukuda
kutsvaga kuti "Kudzai" arimu kombi here pa list rako, unoita seizvi:

Image here
Image here

CHII CHIKUITIKA APA?


Pa line 3 na line 4

arimoHere = vanhuMukombi.muna(munhuAkutsvagwa)
arimoHere = munhuAkutsvagwa irimu vanhuMukombi

Zvikuitika apa zvakangofanana, pa line 2 , tagadzira variable ye munhuAkutsvagwa , tobva tati


ndi "Kudzai" .

Pa line 3 , tiri kuudza computer kuti tarisa mu vanhuMukombi kuti muna variable inonzi
munhuAkutsvagwa here, munhuAkutsvagwa wacho ndi "Kudzai" agadzirwa pa line 2

Pa line 4 , tangoita zvakafanana nepa line 3 , asi tikuudza computer kuti tarisa variable
inonzi munhuAkutsvagwa kuti irimu vanhuMukombi here. Iwewe unoshandisa line 3 kana line 4,
zvichienderana nezvawanzwisisa

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi zvakanaka, unofana kuona mu terminal makanzi:

true
true zvinoreva kuti chokwadi , zvechokwadiwo "Kudzai" arimo mu vanhuMukombi .

DANGER
Chimboedza kuchinja pana munhuAkutsvagwa = "Kudzai" , woisa munhuAkutsvagwa =
"Kudzi" . Wodzokora zvawaita pamusoro apa. Unofana kuona mu terminal makanzi:

false

false zvinoreva kuti kunyepa

Kujamba chinhu mu list


Ngatimboti iwewe sa hwindi wakavenga "Kupa", saka ukuda kuti ukasvika pana "Kupa" mu list , orega
kumumhoresa, ongonyarara. Unoita sei? Pane nzira 2 dzekuita izvi

NZIRA1: UNOSHANDISA KANA , ENZANISO , NA JAMBA

Image here

Image here

Chii chikuitika apa? 🤯


TSANANGURO

Line 1 Iri ndiro list rako riye revanhu vari mukombi


Line 2

munhuWandakavenga = "Kupa"

Apa tagadzira variable inonzi munhuWandakavenga , tobva tati variable iyoyo ndi "Kupa" .

Line 3

pane munhu mu vanhuMukombi {

Apa tikupinda mu list redu riye sezvatamboita kumashure.

Line 4

kana munhu yakafanana na munhuWandakavenga {

Apa tatove mu list kare, saka tine variable inonzi munhu , ichange ichichinja patinenge
tichifamba kubva pane chinhu chekutanga mu list kusvika pane chekupedzisira. Tiri kuudza
computer kuti kana variable munhu yachinja kuita munhu = "Kupa" , inobva yafanana na
munhuWandakavenga . Kana izvi zvichinge zvaitika, computer inofana ku jamba munhu iyeye.

Ku jamba apa zvinoreva kuti computer icharega kushandisa code yese ichatevera kumberi kwa
jamba mumabrackets a kana , yobva yaenda pane munhu arikutevera mu list

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita masteps aya zvakanaka, uchaona mu terminal makanzi

Hesi Panashe
Hesi Tanaka
Hesi Kudzai
Hesi Vimbai

"Kupa" achajambwa ne computer , nekuti wakamuvenga.

NZIRA IMWE YEKU JAMBA CHINHU MU LIST


Tinoshandisa kana , zvimwe , ne enzaniso

Image here

Image here

Chii chikuitika apa? 🤯


TSANANGURO

Apa tashandisa kana na zvimwe , kana usina kunzwisisa kuti kana na zvimwe vanoshanda sei,
unokurudzirwa kuverenga topic ya Kana, Zimwe. Unogona kubvunza pa whatsapp mugroup kuti
ubatsirwe.

Tikuudza computer kuti ichinge yapinda mu list , kana variable inonzi munhu yakafanana na
munhuWandakavenga , hapana zvaunoita. Hatina kuisa code muma curly brackets epana kana
zvichireva kuti computer hapana zvainoita kana tikasvika pane munhuWandakavenga . Asi kana
varibale inonzi munhu isina kufanana ne variable inonzi munhuWandakavenga , computer
ichashandisa code iri muma brackets {} a zvimwe .

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:
1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita masteps aya zvakanaka, uchaona mu terminal makanzi

Hesi Panashe
Hesi Tanaka
Hesi Kudzai
Hesi Vimbai

"Kupa" achajambwa ne computer zvekare, nekuti wakamuvenga

Kubuda mulist
Kana computer ichinge yapinda mu list , inotangira pane chinhu chekutanga kusvika pane chinhu
chekupedzisira chiri mu list imomo.

Ko kana uchida kubuda mulist usati wapedza zvinhu zvese


zvirimo

Unoshandisa buda kubuda mu list . Ngatomboti iwewe ukuda kumhoresa vanhu 3 chete varimukombi
yako iya, obva wanyarara hako, nekuti haudi zvekunyanya kutaura taura.

NGATIRONGE KUTI TICHAITA SEI?


1. Tichapinda mu list

Apa tichashandisa code iya yekupinda mu list

2. Tichada kuverenga kuti tave pane munhu wechi 3 here

apa tichashandisa maths , uchazoona zvedzimwe maths kumberi uku

3. Kana tave pane munhu wechi 3 , tichabva tabuda mu list

apa tichashandisa buda


Tinonyora code iyi seizvi:

Image here

Image here

CHII CHIKUITIKA APA?


Pa line 2 na line 3

Tagadzira variable inonzi nhambaYeVanhu pa line 2 . Variable iyi i nhamba yatichange


tichiwedzera pakuverenga vanhu tapinda mu list . nhambaYeVanhu iyi ichange ichiwedzera na
1 kana tabva pane munhu wekutanga tichienda pane munhu wechipiri, zvichingodaro.
Tagadzira variable inonzi nhambaYekubuda pa line 3 , bvatati nhamba iyi ndi 3. Tichada
kuzo enzanisa variable iyi ne variable ye nhambaYeVanhu ichange ichiwedzera kubva
pana 0 zvichienda mberi

Pa line 4

Apa tanyora code yekupinda mu list re vanhuMukombi

Pa line 5 na line 6

Tikuda kuwedzera nhambaYeVanhu na 1 kana tave kufamba kubva pane chinhu chimwe ne
chimwe mu list .
Patinopinda mu list , tinotanga tiri pane munhu wekutanga, saka apa tikuudza computer kuti
nhambaYeVanhu ngaiwedzere na 1 kubva pana 0 , saka yave 1
Pa line 6 , tikuudza computer kuti nyora() zvinhu 3:
i. "Hesi " - aya mashoko anonyora wezvaari
ii. munhu - i variable yekupinda mu list , saka panonyorwa zita remunhu
iii. nhambaYeVanhu - i variable ichange ichiwedzera na 1 sekufamba kwatinenge tichiita
kubva pane munhu wekutanga mu list tichienda mberi

Pa line 7 , line 8 , na line 9

Apa tikushandisa enzaniso kuenzanisa nhambaYeVanhu na nhambaYekubuda , kana


nhambaYeVanhu yawedzera kusvika pana 3 inobva yafanana na nhambaYekubuda , saka
enzaniso iyi inoita chokwadi .
Kana enzaniso yaita chokwadi , computer inobva yashandisa code irimuma brackets {}
epa kana .
code ichashandiswa ne computer kana enzaniso iri chokwadi ndi buda . Izvi zvinoreva kuti
chibuda mu list , chingosiyana nezvasara kumberi

ITA

Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi zvakanaka, uchaona mu terminal makanzi:

Hesi Panashe 1
Hesi Tanaka 2
Hesi Kudzai 3

ma nhamba aya ekumberi kwemazita ndiwo nhambaYeVanhu iri kuwedzera kana tapinda mu list .
nhamba iyi paichaita 3 , computer ichabva yabuda mu list , ndosaka mamwe mazita asina kuzonyora
mu terminal , nekuti tanga tatobuda kare mu list

Edit this page


On this page

Mashoko
ZVICHIRI KUNYORWA

Mashoko chii?
Mashoko zvinhu zvese zvakaiswa mu ma quotes "" sokuti:

1. "Inini ndinonzi Panashe"


2. "Ndafara nekukuziva"

"2021" i nhamba here kana mashoko?

"2021" aiswa muma quotes saka mashoko haisi nhamba . 2021 inhamba, "2021" mashoko . Izvi
zvakakosha kuziva pauchazoverenga nezve topic ye Maths kumberi uku.

Kutsemura Mashoko
Kana uine mutsara wakanzi

"Inini ndinonzi Panashe"

Unogona kutsemura mashoko obva wagadzira list uchishandisa tsemuraMashoko() seizvi

ITA
1. mu file rakanzi index.shona , nyora kuti:

mustara = "Inini ndinonzi Panashe"


listReMashoko = mutsara.tsemuraMashoko()
nyora(listReMashoko)

2. mu terminal nyora kuti node shona.js , wobaya enter


3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ukaita izvi zvakanaka, unofana kuona mu terminal makanzi

["Inini", "ndinonzi", "Panashe"]

Izvi zvakanaka kuziva nekuti zvichazokubatsira kumberi.

Kutsemura Mavara mumashoko


Unogona kutsemura mavara (letters) ari mumashoko uchishandisa tsemuraMavara()

ITA
1. mu file rakanzi index.shona , nyora kuti:

zita = "Panashe"
listReMavara = zita.tsemuraMavara()
nyora(listReMavara)

2. mu terminal nyora kuti node shona.js , wobaya enter


3. mu terminal zvekare, nyora kuti node index.js , wobaya enter

Ukaita izvi zvakanaka, unofana kuona mu terminal makanzi:

["P","a","n","a","s","h","e"]

Kubatanidza mashoko
HAZVISATI ZVANYORWA
Edit this page
On this page

Maths
NOT YET REVISED

Maths ne ShonaScript
Unogona kuita maths ne ShonaScript dzemhando yakasiyana siyana. Ngatimbotora addition
(kusanganisa) semuenzaniso:

Image here

Image here

Chii chikuitika apa? 🤯


TSANANGURO
Apa, tikuda kusanganisa nhamba 45 na nhamba 5. Computer kana yasanganisa ma nhamba aya,
ichawana mhinduro yacho, asi iwewe kuti ugone kuona mhinduro yawanikwa ne computer iyoyo,
uchashandisa nyora() . Saka tagdzira variable inonzi x tobva tati ndiyo ichachengeta mhinduro
ichawanikwa ne computer pakusanganisa 45 na 5.

ITA

Nyora code iyoyi mu index.shona , wochiita izvi:


1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

ukaita izvi zvakanaka, unofana kuona mu terminal makanzi 50

ITA
Chibvisa + aripakati pa 45 na 5, oisa - , oita masteps emuterminal aripamusoro apo uone zvinoitika.

Dzokorora izvi uchashanisa * na /

Zvinoreva masymbols eMaths aya:

+ - addition (kusanganisa)

- - subtraction (kubvisa)

* - multiplication

/ - division

Nhamba.chero()
ShonaScript ine function inoita basa rekupa chero nhamba iri pakati pa 0 na 9.

Image here

Image here
ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Usachinje chinhu mu index.shona , asi dzokorora izvi uchitarisa mu terminal zvikuitika:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaramba uchingodzokorora izvi, unoona kuti mu terminal muri kunyorwa ma nhamba akasiyana siyana
asi ma nhamba aripakati pa 0 na 9.

Ko kana uchida kuti computer ikupe nhamba iri pakati pa 0 na 5

Unoita izvi:

x = nhamba.chero(6)
nyora(x)

Chachinja apa ndechekuti muma brackets a nhamba.chero() maiswa nhamba 6. Ukaisa nhamba muma
brackets a nhamba.chero() unenge uchiudza computer kuti ikupe chero nhamba iri pasi pe nhamba
yaiswa muma brackets. Sezvo taisa 6 muma brackets apa, zvaakureva kuti computer inokupa chero
nhamba iri pakati pa 0 na 5 kwete 0 na 6. Ukaisa nhamba muma brackets sezvataita pekutanga,
computer inokupa chero nhamba iri pakati pa 0 na 9

NHAMBA IRI MUMA BRACKETS A NHAMBA.CHERO()

Ukaisa 3 muma brackets, computer inokupa chero nhamba iri pakati pa 0 na 2

Ukaisa 6 muma brackets, computer inokupa chero nhamba iri pakati pa 0 na 5


Ukaisa 9 muma brackets, computer inokupa chero nhamba iri pakati pa 0 na 8

Gadzira Gemhu (Game)


Taakuda kumbogadzira game inonzi rock, paper, scissors. Apa tichaiti dombo, pepa, chigero

MUTEMO WE GEMHU
1. Pane zvinhu 3 zvaunokwanisa kusarudza:

dombo
pepa
chigero

2. Iwewe uchasarudza pakati pe: dombo, pepa, chigero.


3. Computer ichasarudza pakati pezvinhu 3 izvozvo asi computer ichashandisa nhamba.chero()
kuita izvi
4. Pakasarudzwa:

dombo ne pepa, asarudza dombo adyiwa nekuti pepa rinovhara dombo


dombo ne chigero, asarudza chigero adyiwa nekuti dombo rinotswanya chigero
pepa ne chigero, asarudza pepa adyiwa nekuti chigero chinocheka pepa

Gemhu iyi tichaigadzira sei?

NGATIRONGE MAGAZIRIRO ATICHAITA GEMHU

1. Tichagadzira variable yesarudzo yedu, yatichati sarudzoYangu ndobva ndati ndi "dombo"

sarudzoYangu = "dombo"

2. Tichagadzira sarudzo ye computer , computer ichasarudza pakati pa "dombo", "pepa", ne


"chigero" ichishandisa nhamba.chero() .

Uchatanga wagadzira list re sarudzo dzese riine "dombo", "pepa", ne "chigero" seizvi:
sarudzoDzese = ["dombo", "pepa", "chigero"]

Taakuda kuti computer itore chero chinhu chiri mu sarudzoDzese tichishandisa


nhamba.chero() . Ukaisa nhamba muma brackets a nhamba.chero() .
Kana uchida kutora chinhu chiri pekutanga mu sarudzoDzese , unoshandisa
sarudzoDzese[0] , izvi zvinoreva kuti pinda mu list rinonzi sarudzoDzese utore chinhu chiri
pana 0. chinhu chekutanga mu list chinonzi chiri pana 0. Izvi zvinoreva kuti chinhu chechipirr
mu list chiri pana 1
Saka zvatiri kutaura apa ndezvekuti:
"dombo" ari pana sarudzoDzese[0]

"pepa" ari pana sarudzoDzese[1]


"chigero" ari pana sarudzoDzese[2]
Isusu tikuda kuti computer isarudze chero pakati pe nhamba 0 na 2
Kuti tiwane nhamba iri pakati pa 0 na 2 tichishandisa nhamba.chero() tinoti
nhamba.chero(3) togadzira variable yenhamba yasarudzwa ne computer iyoyo seizvi:

nhambaYaSarudzwa = nhamba.chero(3)

Apa panogona kubuda 0,1,kana kuti 2. Hatizive zvichabuda ipapo kusvikira taita kuti code
yedu ishande
Computer yaakukwanisa kushandisa variable ye nhambaYaSarudzwa iya pakusarudza chero
pakati pa "dombo", "pepa", ne "Chigero" ichiti sarudzoDzese[nhambaYaSarudzwa] seizvi:

sarudzoYeComputer = sarudzoDzese[nhambaYaSarudzwa]

Tichazoshandisa kana , ne enzaniso kutarisa kuti adyiwa pa gemhu ndiani. Tarisa pazasi uone
code yacho yese:

Image here

Image here
ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Kana uchinge usiri kunzwisisa kuti code iyi ikushanda sei, unokurudzirwa kubvunza mu whatsapp group
kuti ubatsirike

Edit this page


On this page

Nguva ne Zuva
NOT YET REVISED

ShonaScript inogona kukuradzidza nguva kana zuva mu terminal .

Nguva
Kana uchida kuona kuti inguvai uchishandisa ShonaScript, unogadzira variable yenguva seizvi:

nguva = Nguva
nyora(nguva)

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi unofana kuona mu terminal nguva dzacho sokuti 11:02:10 AM

Zuva
Kana uchida kuona kuti inguvai uchishandisa ShonaScript, unogadzira variable yenguva seizvi:

zuvaRanhasi = Zuva
nyora(zuvaRanhasi)

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi unofana kuona mu terminal zuva ranhasi racho sokuti 11/21/2021 . Zuva iri rinogona
kunyorwa zvakasiyana neizvi zvichienderana ne computer yaukushandisa

Kana wave kuziva zvema functions , uchazogadzira function inoita kuti unyore nguva mu terminal
ichiverenga ma seconds

Edit this page


On this page

Ma Functions
Ma function chii?
Ma functions i code yaunogadzira kana uchida kuzoituma kuti basa kumberi. Nemamwe mashoko, tiri kuti
function i basa . Ngatimboti iwewe ukuda kugadzira basa rino mhoresa munhu. Rinogadzirwa se izvi:

Image here

Chii chikuitika apa?

TSANANGURO

Kubva pana line 1 , line 2 , na line 3 , tagadzira basa rinonzi mhoresaMunhu .

Zita re basa rinofana kunyorwa sekunge uri urikugadzira variable .


Pamberi pezita re basa panoiswa ma brackets () , muma brackets imomo munogona kuiswa ma
variable kana kuti munogona kusaiswa chinhu, sezvaukuona pa code iyi.

Pa line 5 :

tangaBasa.mhoresaMunhu()

Apa tiri kutuma computer kuita basa ratagadzira rinonzi mhoresaMunhu() .Ma brackets () haasiiwe.
ITA

Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi, unofana kuona mu terminal makanzi

Hesi

Ngatimbobvisa line 5 rakanzi tangaBasa.mhoresaMunhu()

ITA

1. mu index.shona dzima line 5 rekuti tangaBasa.mhoresaMunhu()

2. mu terminal , nyora kuti: node shona.js wobaya enter

3. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi, mu terminal hamuna chinonyorwa.

Izvi zvinoitika nekuti wagadzira basa rekumhoresa munhu, asi hauna kuzoudza computer kuti itanga
basa racho, saka basa hariitwe kana risina kutangwa na tangaBasa.mhoresaMunhu()

Basa ne ma variable
Unogona kugadzira basa rinotora variable inozoshandiswa ne basa racho kana razotanga. Ngatomboti
iwewe ukuda kugadzira basa rinomhoresa munhu asi ukuda kuzopa basa zita remunhu wekumhoresa.
Unoita seizvi:

Image here
Chii chikuitika apa?

TSANANGURO

Apa ukugadzira basa rinonzi mhoresaMunhu , asi ukuudza computer kuti kana basa iri rave
kutangwa, rinofana kupihwa variable inonzi zita ichazoshandiswa na nyora("Hesi ", zita) .

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi, unofana kuona mu terminal kuti

Hesi Panashe

DANGER
Ukada kuenda kutanga basa usina kuisa variable, computer ichakuudza kuti

paita problem, basa rinonzi `mhoresaMunhu`


ranga richifana kupihwa variable 1 asi iwewe waisa mavariables 0.
Basa re Maths
Tikuda kugadzira basa rinosanganisa ma nhamba 2 arinenge rapihwa.

Image here

Chii chikuitika apa?

TSANANGURO
Kubva pa line 1 kuzvika pa line 4

Apa tiri kugadzira basa rinonzi sanganisa , basa iri rinofana kuzopihwa ma variable anonzi
nhambaYekutanga na nhambaYechipiri anofana kunge ari ma nhamba nekuti haukwanise
kusanganise zvisiri ma nhamba

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

Ukaita izvi unofana kuona mu terminal makanzi

43
Unogona kuchinja ma nhamba oona kuti chii chinotika, kana kuchinja + oisa - , kana * , kana /

Basa rinoshanda ne nguva


Mirira _ seconds
unogona kugadzira basa rinomirira kuzotanga kana papfuura ma seconds aunenge wataura iwewe

Image here

Chii chikuitika apa?

TSANANGURO

Tangodzokorora kugadzira basa rinonzi mhoresaMunhu sezvataita pakutanga, asi patagadzira basa
iri, taudza computer kuti mirira 3 seconds kuitira kuti kana basa iri razotangwa, rinomirira ma
seconds enguva 3 robva razotanga.

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter


Ukaita izvi, uchaona kuti mu terminal munombotanga musina chinhu kwenguva diki, mozonyorwa kuti

Hesi

Hesi anyorwa padarika 3 seconds dze nguva

Dzokorora _ seconds
Unogona kugadzira basa rinodzokorora rega kuitika kana papera ma seconds enguva aunenge wataura
iwewe sokuti:

Image here

Chii chikuitika apa?

TSANANGURO
Zvekare tagadzira basa reku mhoresaMunhu , asi apa tikuda kuti basa iri rirambe richidzokororwa
kana papfuura 1 second ye nguva.

ITA
Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter


Ukaita izvi, unoona kuti mu terminal mucharamba muchinyorwa Hesi kana papera 1 second yenguva

Hesi
Hesi
Hesi
Hesi

Mu terminal imomo munoramba muchinyorwa kuti Hesi kusvika computer yako yadzima

Ndoita sei kana ndichida kuti Hesi amire kunyorwa?

KUTI HESI AMIRE KUNYORWA

1. mu terminal , baya control na c panguva imwechete. Izvi zvinofana kuita kuti mu terminal
mumire kunyorwa kuti Hesi

Gadzira basa rinonyora nguva mu terminal

RONGA

basa iri rinofana kunshandisa:

i. nyora()
ii. Nguva
iii. dzokorora 1 second

Kana wapedza tarisa code yacho pasi kana yako yaramba kushandisa

Image here
Kushandisa misaBasa.
Unogona kushandisa misaBasa.mhoresaMunhu() kuita kuti basa rimire. Ngatimboti tikuda kumhoresa
munhu la 3 , tobva tamisa basa . Tinoita sei?

RONGA
Tichashandisa zvinhu izvi:

1. basa dzokorora
2. nyora
3. kana
4. enzaniso
5. misaBasa

Chimboedza kunyora code iyi wega woona kuti zvinoshanda here

Answer

Image here
TSANANGURO
Tinotarisira kuti waakunzwisisa zvakawanda zviri mucode umu, saka tichangotsanangur zviri kuitika
kubva pa line 9 kusvika pa line 11

variable inonzi nhambaYekuverenga icharamba ichiwedzera kubva pana 0 kusvika 3


ikasvika pana 3, yaenzana ne variable inonzi nhambaYekumira , saka pa line 10 , tikuudza
computer kuti misaBasa rinonzi nyoraNguva()

Edit this page


On this page

Mhinduro
NOT YET REVISED

Unogona kuda kunyora code inoita kuti munhu apindure mu terminal , sokuti unogona kuda kuti munhu
anyore zita rake mu terminal , iwewe wozotora zita iroro oita zvaunoda naro zvakaita seku mhoresa
munhu iyeye. Tarisa pazasi apa, uone kuti izvi zvinotwa sei:

Kuita izvi, tinoshandisa zvinhu 2:

1. teerera mhinduro _
2. tora mhinduro _ {

Image Here

Chii chikuitika apa? 🤯


TSANANGURO
Line 1

teerera mhinduro zita

Tiri kuudza computer kuti iteerere zvichanyorwa mu terminal . Kana yateerera zvichanyorwa,
ichabva yagadzira variable inonzi zita . zita apa ndizvo zvese zvichanyorwa mu terminal .
Kubva pa line 3 kuzvika pa line 5 Apa taakuudza computer kuti tora mhinduro yanyorwa mu
terminal ine variable rekuti zita , obva wa nyora kuti "Hesi ", zita

ITA

Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

mhinduro: zita:

Izvi zvinoreva kuti computer yakamirira iwewe kuti unyore zita rako kana chero rimwe zita
raukuda kunyora, mobva wabaya enter . Ukaita izvi, uchaona mu terminal makanzi:

Ukaita izvi, ukanyora muterminal zita racho, unofana kuona mu terminal makanzi

Hesi (zita rawanyora iwewe)

Waakushanda kuzvitupa zvekare


Takambokupa basa rekuudza vanhu vauya kuzotora zvitupa kuti vaende ku Office kunotora chitupa kana
vaine makore 16 zvienda mberi, kana kuti vaende kumba kana vaine makore 15 zvichidzika mutopic ye
enzaniso. Patanyora code yezvitupa, takagadzira variable inonzi makoreEmunhu tikabva taipa makore
acho iri nhamba . Kana wakanganwa, tarisa pazasi apa code yacho yese yatakanyora

Image Here
Unoita sei kana uchida kushandisa mhinduro kuwana makore
emunhu

Chiita uchishandisa mhinduro

Apa taakuda kunyora code iyi zvekare, asi ikozvino pane kuti ugadzire variable yekuti makoreEmunhu
sezvawakaita pa enzaniso , uchagadzira variable iyoyo uchishandisa teerera mhinduro seizvi:

teerera mhinduro makoreEMunhu

computer ichamirira kuti makore emunhu anyorwe mu terminal , iwewe wobva watora mhinduro iyoyo
ochishandisa code iri kubva pa line 4 kusvika pa line 8 mu picture iri pamusoro apo. Kana wapedza,
code yako inofana kuita seizvi:

Image Here

ITA

Nyora code iyoyi mu index.shona , wochiita izvi:

1. mu terminal , nyora kuti: node shona.js wobaya enter

2. mu terminal , nyora kuti: node index.js wobaya enter

mhinduro: makoreEMunhu:

Izvi zvinoreva kuti computer yakamirira iwewe kuti unyore makoreEmunhu . Saka nyora kuti nhamba
yemakore acho, wobva wabaya enter .
Ukanyora nhamba iri pasi pa 16 sokuti 12, mu terminal munofana kunyora kuti:

Uchiri mudiki, unozodzoka waane makore 16

Asi ukanyorawo nhamba iri pamusoro pa 16 sokuti 21, mu terminal munofana kunyorwa kuti:

Enda ku Office kunotora chitupa

Edit this page


Ma Objects
COMING SOON
Not yet available

Edit this page


ShonaScript to JavaScript
COMING SOON

Edit this page


ShonaScript to Python
COMING SOON

Edit this page

You might also like