2. Introduction of Cairo Language

Starknet BootCamp · November 2023 · 55:13

GianM, a Cairo and Rust developer at Quantum3 Labs, introduces the Cairo programming language.

Speakers

Topics

From Starknet BootCamp, published by OpenBuild; community: OpenBuild.

Transcript

hello hi everyone we are going to continue with the stet boot camp in the first lesson we talk more about the stet ecosystem and this time we're going to talk more about the kaido language how to use kaido language how we can interact with the uh stet blockchain and this going to become more like a technique so you're going to get more technical skills uh from now this is me my name is Jam Marco you can find me here in GitHub or telegram Discord with this like same profile picture uh you can say hi there so yeah we're going to do this the start boot cam so let's go

together this is our the first website we're want to check more doing all of this boot camp this is a start book so here we can find all all the resources that we need we're going to talk about a lot of tools like Starly scar remix stet Foundry all of them so this is like the first page we're going to check and see what is it yeah let's go for it so like you said this is the St book you know is they have a lot of contributors they try to do their best to show what is a stet so I think guys uh you can check more on this so we're going to jump on here so this is this is the part that we like

more so they say for educational resources like now we can check all of these links so one of these is the star links that we are going to do this week this is like a you know a bunch of challenge exercise in order you can learn get familiar with the Kido language is it the second section we're going to check now is the introduction because we here they talk more about what is blockchain uh something about theory part key features what is kaido why kaido so this is like so this is could be like a a homework for you guys check the first chap uh chapters and read about it so now we go to getting a start so yeah this is like we're going

to do right now so the idea of this lesson is to interact with the blockchain you know we have to build the smart contract deploy the smart contract pain something in the in the blockchain that's the idea for the lesson so we're going to jump direct into this section and getting a start so we're going to read more about it so this start is a layer to solution they use C progaming language into stet and for this we are going to use what starnet remix plug-in maybe some of you have experience with remix this a useful tool in order to learn or to getting touch easily with

the blockchain and smart contracts it really famous in solidity for ethereal but now there is we also have this plugin that is going to help us to work with uh starnet and kaido so following this section we're going to check there thisit the remix project uh let's go for it this two so when you check here you're want to see all of these like website so for now yeah but I have a much better idea let's go for it let's go in This Way remix a smart contract so we're going to check this is from the you know from zero so yeah the first time that you're going to interact with this you're going to receive this

message just go as set here they going to explain you what is here what is there so yeah we have this when you got into this like interface is like a bit there is too much content here they also have some yeah like example how to work with these first we have to delete all of them because we're not going to use them so let's go for delete okay delete okay okay then it's empty now we can create a file contract uh a KIRO fine but let's go back to our our getting started yeah much better now so like they say we have to visit the remix contract we already cleaned something now we have to navigate into the plugin

ction so let's go for it and we have to enable the start plugin like we can see this is like the normal remix that we can see every time so with this we can compile and deploy solidity contracts but not start contracts or Kido contracts so let's say we have to go here to for the plugins we have to search for the Kyo tnet sorry tnet and we have to activate it so it's done now you can see we have one more icon here to accept remember this and accept Okay now we have the plugin now after this yeah we can check and it's almost the the the same interface and they say yeah

this is going to enable the the left side bar the icon that which we saw with the logo so now the this example we show the this is like a basic smart contract so the idea for this for now is just copy and PR this smart contract and then we can you know uh check on line by line and and see what does it means so we can copy all of these and create our ownable KIRO contract here also we're going to read more about what is the contract but let's go for it first two oh yeah yeah we have to let's leave it there just we have to yeah find KY and here you have to P this yeah

have to say okay okay okay so we have our first contract it's just like a like this copy and paste for today but we let's read more about it the I mean here the start would explain what does it means so here they say we have the dependency and interfaces so yeah uh likeing smart contracts we have some dependencies an interface to call in our smart contract for example here we can check this yeah is there we have to call like the core library of a stet and call the contract address object so after that we say we have to import also the ownable trade so

here we have the ownable trade you might realize uh if you are not familiar with kaido and this like a trade they have for they have this for because because you know kaido is more like a Ras like language so kairo has adop a lot of the RAS feature so in car we have this like um keyword trade in order to enable inheritance and a lot of new new features so that's why we have the yeah we have this trade here and you also can see this is like a genetics for R so yeah so we have this on unable contract

in order to specify functions for transfering and getting ownership and then we also have events of really importantance in smart contracts so we have create one event so that it's going to be immedate in the during the interaction so for the event they have this this is the way we can set up events in in a smart contract in kairo with this uh annotation attributes and then also this d drop St the band we have to define the name of the band here yeah don't worry too much about it this is like the first time we check this contract so for now just like a simple it's a general overview now like similar to another different chains or smart

contracts Kyo a smart contract in starnet they also have like a storage in order to hold the contract state with a current or owner address so in this case we have our storage here yeah and the only field it has for now is the owner and it's going to store the contract address what else we have there the Constructor like is going to initialize the contract with the starting owner so it's going to have one input parameter this is our Constructor so this is like a default parameter it's on a self default but in the book it means we have this is going to be our input parameter so we have to you know pass one value

when we call the co Constructor function we're going to see this during the example with remix we also have the Constructor external function private functions the external functions it can be called it yeah they are functions from transferring ownership and retrieving the current owner details yeah maybe you're familiar like with solidity so they have also external function and private functions and for this time the last one is private priv methods so in this case we Define the only owner it's going to like say validate if the color is if the color of the contract is the real like um current owner so yeah like they mention yeah for

the external functions for the functions we have the the transfer ownership we're going to transfer the you know the ownership of this contract to another contract address and get owner is just going to read who is like this time who is the current owner of this contract and the for private methods we have the the only owner is going to check going to make aert if the color is the is the actual if the current owner contract yeah that's it yes just this is just like a general overview of the contract later on the next lessons we're going to talk more about it in the details for now just don't need to worry to much the the idea for this lesson is to uh

compile uh deploy the smart contract um yeah interact with the remix with the remix website and yeah let's go for it and after this yeah we talk about the smart contract the compilation process like they say in my case in our case we did it we already create the ownable Kido contract so here we pasted our all our code and the step two is the compilation so here they say uh we have to compile our smart contract the so the smart contact is there we have to go we have to Omit all of these two like icons because they are for solidity we have to only work with the start at one so let's

go click here so they say because we didn't delete the this file hello War now the startet plug-in still can recognize this so better we delete it now we don't need it okay so now yeah we only have the ownable C contracts much better so let's go for it compile here it's going to take a while you can see it's compiling to SRA file and after that it's compiling to cust I see okay everything looks good so for now let going to check here yeah like you can see now we have this directory directory so here we have now two files

one of these files is the Json file so here actually is all the details about is the a contract so here we can find the AI of this smart contract as you can see yeah the selectors the AI here so yes quite similar to solidity also you can do something similar to this so it is like a the the first step and after that we also have this like a custom file that is going to get into the so this is the the flow from KIRO contract we go to the C file and from the C file we can get the like file and and this and then we can deploy this in the

blockchain this last one file so this we already compiled now we can deploy but remember because when we deploy we have to pass the build a Constructor so our Constructor we have to pass a smart contract so in this case in order to deploy we have two options to deploy first uh we can pass the we can deploy on remote DEET or wallet we going to do both of them so for remote DEET is going to be easy we this is like a already pre setup account so we just can copy this pres setup account and paste this here so we have to because we have to pass the owner of the contract here so this

is the contract address and remember is this for is the first smart contract of all of these list and then we're going to use which one the remote dep net uh uh Network in order to make it like easily so let's go for it deploy is going to take a while we already have the Clash has yeah a lot of new terms here so this deploy contract has two process actually behind the scenes they first declare the smart contract after we declare like you see we got the class has of the smart construct and then they actually deploy so uh everything looks good we got the yeah we got the contract

address yeah it's good so let's follow the book we did almost the same yeah we compiled the let's recap a bit we we compiled the ownable Kyo contract we got the artifacts file you can see we got this artifact folder and then we got the SRA file and the custom file after this what did we do we choose the remote in order to deploy our contract yeah and we select like the the first account from from it and we also get the same this result yeah we did the deploy and we get almost the same like output from there and then like they say oh you can you

successfully deploy your first smart contract and that's what we did we did this and this is quite similar like the St book great let's go on now we have deployed the smart contract you have to interact with this so we have some we already defined some functions there so one of them is like the basic one just get the owner so it's just just like a read function we can get so let's look here yeah we can see we can ask we can read the blockchain and just retrieve the owner of the contract so see oh this is the result okay this is working and you can see this is the same address like we input before you can check hereo before we input here but is the same add

like this so okay our smart contract is working as we expect no problem there this address is the same like this after that what we can do so we got we press the get owner button and we get our smart contract in this case it's a bit different because they use different contracts no problem in that and now we can invoke for this is in the startet ecosystem they have this like a terms if you're going to call like a read only only read contract they they use this term like a calling but if you're goingon to you know change something in the blockchain you have to invoke I mean

in the smart contract you are going to uh you have to invoke so we're GNA we're going to update some values there so if we're want to update some we're going to call it like invocation or invoking in this case so in this case is the transfer ownership so now this is our actual owner so we have to change the owner of this contract with this function so here we have a lot of a lot of like um contracts we can choose any of them let's choose this one 3aa let's copy this let's copy in I think you can open any file copy and paste there for this and remember you have to go back to our previous smart contract otherwise

you cannot interact with a contract back so okay we are back and we have the smart contract or the contract address that we don't want to change into so let's interact with this you already called the get owner before so now let's invoke that transfer ownership so like you see we have to pass the address I'm going to pass this address contr c contrl b okay let's go for it you see it has we have the transaction has it's working behind the scenes it looks good yeah so now if we call this get owner what do you expect we're going to receive this contract no we're going to

receive the contract that we just set up this is the new address so let's see yeah now our when you we call get owner we have the new owner here this is like 3aa is the same the address like this so our contract is working very well well so yeah uh let's check again into the book they talk almost same so for now yeah we call the transfer ownership we call it invoke in this case yeah they have this result and yeah so until now like you can see we have like a compile deploy interact with our first stet smart contract so yeah you can do the

same in this case try to remember all the steps try to follow the book and the videos at the same time try to change something there and see how how it works so of it it fails yeah uh but what okay so after this we have to go to the test net so now remember we all everything that we did especially in the deploy interaction we did it with a remote demet the next level of a step is to do it with like a test net so let's go for it you can reload this to see how how it goes in this case we don't have to delete this compile is okay we can we

can keep the the same artifacts but the the way we're going to deploy um interact is going to be different let's go for it we have this y yeah okay we have the compile we can go anyway so let's check more about it in this case here they are asking for to deploy the this like um inest so for this we going to we we have to get our wallet smart wallet in startet we have like a Bravos Argent they are two of the most famous SM wet address so the the idea is like you have to check the website any of them and yeah add it into your browser

so for this let's go back to our previous browser because I I already have one there yeah it's okay this we're going to call remix again call remix and we have to pass this okay okay okay we have remix here we have our own our contract here we have the we can compile here it's okay but in my case I already have the Bravos wallet so we are going to see how does it goes remember this Choice okay okay okay it's already already compiled the file but in this case we going to work with a wallet in this case we're want to choose

Bravos we have to accept uh case yeah it connected you can see I use this wallet Bravos my first account is yeah it ends with 38 38 the same so yeah it's connected now so in your case uh if you have a new wallet you have to deposit and get some tokens from the faet for example like my second account my second account is empty if you just have created a new wallet it's going to be empty so how do you get the wallet yes you have to follow this yeah we have

to check the website of Bravos or Argent and get a wallet in my case I already get it so don't need it but um and then during the they also explain that we have to get a foret and deploy the account to the network actually most of the people they get problems with this because they face some errors because they didn't deploy the deploy the their wallet so if you are a beginner maybe how can I deploy my wallet is a bit tricky what is it so it means just you have to interact with the network we have to just get some faet or maybe send some testet token to another wallet address that's it

in this way after yeah 10 seconds you're going to get your wallet deployed in my case my second account is empty so it means I just created it so it means it's not deployed yeah it's just there but it's not deployed so we're going to do example just using this wallet um and let's see what what's going to happen so let's go for it let's follow the oh yeah let's let's repeat again all the process that we did before with the deet so but let's do it like quickly so the the EIT owner who's going to be our address this address is the same like this is the

same um I don't have funds okay this is like I just like say bad example but let's see what's going to happen there we're going to do like experiments here so yeah we pass this let's try to deploy oh and you see please set up deploy your wallet they also say set up and deploy your wallet account on chain before trying to deploy your contracts yeah actually why why do we get this kind of error is it because my contract has sorry my wallet has zero funds so it means I don't it's not deployed yet so let's switch it I'm want to go back to my first account it

has phones it's already deployed because I have have it with a blockchain and here also no let's reconnect so yeah oh veryify here three 3o okay okay now let's pass this contract here deploy now yeah no problems and deployed it on testnet so now it's it's going to deploy on testnet let's see how it goes this is this is the deploy that failed before because we we use it like like not deploy it smart smart wallet but now it's working very well you can see the check here I got it new transaction there because yeah every time that you

deploy is yeah you get a new transaction on testet and see let's check get owner and we going to realize it is the same it is the same address like this so yeah great so yeah this is this has been our first smart contract we did the process of compile deploy and interact with DEET and testet so wow we did it too much and yeah like you can see we're following the stet book I did it in my way you also can did it in your way just follow the stet book and yeah that's IDE I try to experiment for now because it's de dep net and testet it's just you can do

whatever there so no problem yeah uh see you then now after this the idea is to not to get too much into the smart contract for now so after this we're going to check starlinks like I mentioned before is this this is star Lings here here here starlinks so and this section we are going to learn kaido as a language so we're going to see what is the basic of kaido in order to understand more about the smart contract so first interact with the blockchain yeah we have to you know deploy compile them but if you really want to understand what this like a smart contract means so we have to actually

learn Kyo language first so that's it see you in the next section hello yeah we go into the next section of this lesson like I mention we we have to work this time with starlinks they are like a bunch of exercises we have here so so what we have to do is just to follow this R mey how to install and how to play with this so in this case we have to install the RAS because Ras language is going to use Ras behind the scenes also have to do that jit clone and car ram Caro Ram be watch so for this in my case I already did it for this for

example for the G clone I have my repo call it Starling Kyo one I'm going to skip this small few steps because it takes long I have this for example yeah I have this file you're also going to get the same file when you get this file after the yeah after the first step you're going to get this file same like me so we have to better we have to open this you know program in my case I use Visual Studio code so I open like this you have to open with any you know code editor that you like so yeah we have this we have this great we have the Kyo link here open like this okay much

better so we have the KIRO working let's go this two for now here we are okay okay so like I mentioned we have to follow the Ry we still R we clone the repo let's go to the directory we have to run this command because I already I already did it before it's not going to take too much but in your case maybe it's going to take a while for you but in my case I did it before so it's going easily then we have to do the last step with the watch or the sorry for this again one more time so up we going to do we have to do this here actually I have to do this here and great great great everything is working PR well so the

idea here is to solve all of this challenge in order you to get more familiar with the Kyo language so we're we're going to do one by one just half of this the other half is going to be like a homework for you guys so yeah let's start let's see how what do we have to do so let's follow the instruction welcome to starlings yeah this is so this is the hint this explain what do we have to do so the the idea is to compile the program should compile so uh yeah in this case we only have to do is remove this like this command we have to remove this command let's see how the Oh yeah because we run with watch it is

working you can see we are in the intro. one this is the first F that we have to solve among all of this exercise we have to intro already delete the I am done so it's okay but now we have to go into the second one is intro that to so we jump into this and the same this is means we have the here but yeah let's go for it and let's the IDE is to understand this this process yeah we are in this file it build successfully but you can see here this exercise this won't compile so how to make compile since it's going to be always a Kyo file Kyo L yes so at least it has to have this here the F the main

function so only in this case what we have to do is have to P the main function system M if you want to you know compile a Kyo file you have to have this function at least empty but you have to go it so how is this two great uh it's working I'm done yeah I'm not done we have to get rid of this comment I am not done in order like you know to jump into the next exercise so like you realize the dynamic is like that first try to you know solve the challenge once you solve the challenge you have to to remove this like a comment like I did here and like I did here now we are into the next exercise

is call it variables one so we are done with intro we go to variables is where here number one so you must to pay attention which is the what is the next exercise so is this one we go B one so same you have here the hints they going to give you you know some suggestion what to do so the idea is like um always to compile the program so we we have to find the error so remember in Kyo it's like a Ras we just have decare X we assign fine to X but before to you know to create a variable we have to write

let so let X and then we assign five to X so it should work now see yeah great it work it it work so so when we got this next step is just to delete this comment and jump into the next file I mean to the next exercise so now you see we are now in the number two let's move it so yeah everything is like this just jump into the next exercise so the idea for you guys is you can stop the video now and try to solve all the exercise that you want just in case you face you know some problem you spend so many time in one exercise you can come back here

to the video and watch how to solve this and the next option is to check the Kyo book actually all of these exercises they are quite similar to the Kyo book so it means if you check the book you can get the idea how to solve this so I want to introduce you again the next website so first we talk about the star links but also you can see here we have K documentation let's see how what is here so what is this what is this documentation this one sorry about that yeah this is the most updated documentation so first we have to check the stet book and then we also have to

check the Ciro book so in order to solve these exercises like this it's a good idea to get you know to get support to check this book to solve the balance easily if you think that you cannot you know solve it better check the book and also you can check this video so okay guys you can try to do it by yourself as much as you can otherwise check the book or continue following in the video and let's see how it go okay we are in the exercise number two so what is wrong here they say let X usually when you declare the you know some variable you always have to give some initial value

it could be zero in this case let's see if this work work there but it could be any value actually it could be 50 60 anything there you can see it's going to work any that so like you realize there is not just only one answer there are many answer multiple answer in order to solve this uh challenge the idea is like to compile the the program and we also can add this what is specified data type it could be U 16 see if it is working or not yeah it's working great so let's jump to the next one we have this failed Le print so what's wrong here like before we declare

the the variable we give it a data type but it's not working no sorry for this I have to get wrong I have to get r of this that's why we have to jump to the next one yeah number three now okay okay okay okay we got this so what is a fail by the way what is a fail 252 so if you are familiar with dra yeah you know Le X something like this but this like a fail data type it's really you know it's just like a for stet for for kaido so in kairo we're gonna see a lot this data type to summarize is like we use this like for like a big number

big like a prime number it also can work like a a string because in color we don't have real string so we use this first variable to store string so we going to see it on the examples so the idea is to make it work so let's give it a a sign value here let's check is is going to work or not oh it work like I say it can be like a string or also so let's try it can be a number as well let's give it some number like this let's see how it works it also work it can be maybe like an address let's see if it works or not so yeah don't get too much confused with

this I know this is like a new data type for us you can check more in the C B what does it means so uh in start we use this a lot so like you realize we can store a stream or number or address it's working for all of them let's jump into the next one oh but always you have to remove this we remove this one and we pass to the four one okay number four what is wrong here yeah we have this lead X but here we have X again they say don't change this lines so we have to change here or here but for sure we I don't going to change the print so the only option is

to paint something here so you you can see the value of x is changing so here we have to add like a m so now uh X can change it without problems before it was immutable but now it's mutable so now we have we are allowed to change the value this like a Ras if you know Ras cool you can get the idea let's go to the but first this let's go to the next one in the next one yeah yeah they say again don't change this don't change this don't rename this so don't change this line don't rename this line don't rename this P don't don't change this line let number equals this don't change this

line okay don't don't rename so we are not going to rename so we can change here the so it's a bit confused but just the key is here don't rename this ni so we don't have to change the the name of this variable so in this case we can do this let here we declare we apply here like a shadowing shadowing is a technique there or some R so now the now the compiler at the beginning check the value of number is one but at this point the value of number is three so here we apply like a shadow wi from Ras you also can check there it's working so we jump into the next one should be number six

here what do we do we have the cons con oh yeah in this case we also can check here the problems we have the trace here the logs what is wrong so for constant number we have to declare it before the outside scope of the function but this we have to specify what data type is this in this case like a printed type so for number we can give it we have to specify like you could be any of them 16 let's see how it goes oh number equals to U6 oh I realize maybe it is not working so let's try to the a different way for this actually if you want to

really make sure you have to check the the Kido book in my case I'm just like you know like you're just guessing how does it work let's just like f the language oh sorry it's not three it's like this one more time yeah we declare and then we pass the value oh you see so now this line number seven is working very well the problem is here so now we found what is the answer so yeah like you see you just try something test it try something test it if it doesn't work just try to change something there in order to you know to pass the test I can do like eight going to delete here okay let's see how it goes great we did it

for this exercise we took a bit more of time we made a small mistake but we you have to still continue thinking about it how to change it if you cannot do it just check the title book and you can find answer there in some way great we go to the next one is this primitive types we have to find the file here it's not this it's not this primitive types here for primitive type let's check what is it okay we going to work with Bulls so for Bulls you say let if your money equal true is it it okay okay so here we have this V variable but we didn't

Define it yet so we have to do it like above we can give any value it could be true or false it's okay as long as we you know we give it a value initial value so it's going to work you see it's working it's going to be true or false oh sorry false let's see it works great it could be any of them as long as we pass the test next one do it yeah type two yeah we saw type two but is on here we you know you always have the all of these like suggestion here they explain how to solve the challenge otherwise just check on the on the code you have this alphabetic you have this modood

okay this let think is is like like an example resource string okay in this case this is like our example we have to try to do some like that here so here we have this variable is alphabetic okay here they use my first initial see here they have your character but they didn't Define it anywhere so what we have to do is to declare Define this and give it a value your Char in my case because my name is start like this so I can do this but you see we have to add also more here okay let's see how it goes the test oh I missed the

semicolon there okay okay great it works we jump into the next one uh number three how is this C let name print so yeah uh this is interesting as well so we have cut here and you can realize this could be the name this could be the AG of the C of the card so here we have two decouple we have a tole but we have to decouple this tole into two like small variables we have to name is this name and H is going to be equal to C okay see oh let me this this is also similar to Ras if you know

Ras like I said before you're going to do it more quickly yeah we go this with with this okay okay now we have a bit more here okay we have to solve with this some better just jump to the Todo we have to do here so modify the type of this function to prevent overflow yeah you have this those like u8 values what happens if they sum up each other and you know it's a big number so whether we there are many options or many ways to solve this let's try let's try to chck in this last one so the next value could be U6 so what we can do is we can check here this into you know into into see

how it goes great we don't have error here for B number let's leave it for now like this we have error here to do return X as a fa yeah like I did before let's try two let's try to solve it first and I can explain a bit more about this but first let's Solve IT F into two oh it's going to be difficult but let's try into no try into okay let's see what's missing here in the assert okay 40 40 to do mod uh modify this test so yeah we have to read here carefully so we also have to change the test usually you

don't have to change the test because they supposed to you know to work well but in this case they mention explicitly we have to modify the test to use the correct integer tag because that's what we did for this function some big number is here we have like a input UA UA we decide to do that the outpos could be U6 same here we have u8 u8 but this is still u8 here this should be U6 so like they say don't modify the values we didn't modify the values just the types yeah we modifi the types so it's good okay let's see how it goes awesome it's working but let's recap a bit one what's going on here what does it means this X Plus X actually we we can do something

like this you know we have this small value UA we want to you know to convert to change into U6 since you already have the small value and you want to you know change into a big value 100% of the cases is going to work yeah because you're you're going from small to big so there is not going to be any problem with memory or storage with this that's why we can use this x into so it's it's going to inference what's it going to be the last value of what's going to be the you know the real the real data type for this but let's make it a bit more explicit let's write let equal to X U6

U6 let be same U 16 right and now we have to turn a plus b let's see if it is working or no oh sorry I I don't know I forget to I forget the semic colum let's see a plus b they don't want to oh my typo let is working now so I think this is much better to to see what's going on so we have like a cast yeah another language cast you can cast this A2 into a16 we can name any no it could be a the letter A so also we can cast our first second

value u8 into U6 so at the end if we sum up these two values is still going to be U6 so we just do like this 16 yeah this one is is more explicit but you also the previous one that I did is also working so you can take any of them this is almost similar to this no problem but yeah remember felt felt is really really a big big number it means the value is you can check what is the maximum value but is really big so if you change from small value size to Big Value size just use this into because you're are always sure that it's going to work so no problem with that but what happen if you have to convert from felt felt is a big

value into UA is a small value so there might be the chance that this big value from the F cannot be stored into the UA that's why you have to you know to do this apply this try into because you want to try you're going to you're not sure it's going to work or not if it it work you have to unwrap because when you do the try in it's going to give you a result or error so you know you have to handle this in this case yeah the easiest way to handle this is just with unwrap but yeah if you have your real problem you have to find more much better ways how to handle this but for now it's working so it's okay the test that we did great great great so quite interesting this one let's jump into

next section operations operation operations here operations can find okay oh we have this function po yeah we have to multiply and divide so okay okay we have to fill this here we have to do this into here so we have to our x value time x value time value time x Value Plus Yus 2 it's is going to be our rest yeah let rest equal to this value is okay what you have oh it's working now great this one just we can do it quickly now what's going modulus here also yeah have

to work with modulus here calculate the modulus of X and Y so yeah just do it percentage percentage y let rest here one floor division similar to this but remember if you do the copy paste remember to change carefully what you're doing multiplication yeah same if you have the copy paste remember to change carefully what you're doing okay it's working now I'm done let's move into the next one operation what's on here exerise if or if if okay and now we have to work with if and else how is what how is it in kairo they say not use

another function call addition variables yes if else okay let let's do it oh bigger okay okay let work here um so we have to check which one of this number is the bigger yeah assert yeah you also have to you know in order to get more idea how to implement this function you also have to check the test you have this bigger function you have to pass this one number and second number asserts that the biggest the bigger number in this case 10 so yeah otherwise oh yeah okay okay so if a greater than b she must return a else B so let's see how it

goes okay well let's see if a is greater than b you return a otherwise b or it depends you you want to optimize a bit more just you can do just like this it's going to work anyway let's see oh oh maybe no in this case KIRO is exhaustive it means it one like explicitly you have to say if how the if and else is going to work or not maybe you can find a way to do it you know in a short weight but in my case it's just working like this let's see how it work yeah it works well but what if I just want to you know if the first condition isn't working I can

just be here but I cannot do it let's say one more time this is first solution is working but you know I a bit picky maybe I like more this way and let's see how does if Block in types error if BL in yeah it's like um KY syntaxes do not allow me to do this so better let's keep just like that if you guys can find you know the shortest way to solve it you can just let me know let's move into the next one oh but let's remove the I'm not done two if two

if2 what's going on here if finish is f we have to return full okay if this is f we have to okay we have to complete this like if else next it if else okay I'm going to do the copy paste if equals to what equals to F already have F no it's done F we have to return what bar anything else return bass okay let

see B is working you know felt like I mention it can be kind of like a string literal here so it's [Music] okay let's move into the next one the next one is functions functions function call me yeah we have this function call me but we didn't Define it yet so it's just could be empty function let's see it's work like this or not great it's working so you know if you want to call a function first you have to Define it okay next one if you want to call the function you call three but you didn't specify what data type is this so we

just to give it any integer data type it could be you 16 is okay yeah it's working okay next one oh sorry in this case yeah we Define with the you know input value but we didn't pass any just give it the number 56 it's going to iner that it's going to be you 64 so no problem with that we can also give it like this let's try4 great still working okay next one oh we have to get rid of this here yeah this now we have to read this like a problem this store has this store is

having a sale where if the price is even number you get 10 car but if it's odd number but if it is the odd number it is three k box off okay okay okay I am not the original so price even even what is the other one even percentage two two price is an even number okay we have to check the price here if the price is even number you get 10 KIRO bux off okay

but if it out number you get it is three KIRO off okay no one the function body we are interested in the signatures okay get the signature price original price is even number we have to pass the price why they say is not working working here function sell price okay yeah we didn't return any value it was like easier than we expect it just have to do you two yeah sometimes just you have to add something really small big I mean small and you can solve all of this but yeah it took me some time okay let's go next

one functions functions where we are quiz okay now it's the quiz I think it's time for you guys to to shine you can do it you already got the basic here you have to pass this quiz it's like a homework for you and you can see also we have like more more like exercises uh better you do it in order to get more familiar with kairo but for now yeah I think it's it's uh on your side try to practice always and yeah that's it we finish our you know listen tool with the star Lings then yeah you have to do it the

rest of this by yourself okay see you next time