Elixir Excerism Track - Lesson 2 "Lasagna"

Elixir Web Development
Transcript

English (Auto-generated)

Hello. So I just finished the third lesson. So I am going to go ahead and do the homework which is the lasagna exercise on exercise. Um So I've included? Excuse me? Um both the learn elixir file that has all the notes in the last lesson um which I push up to my gatehouse as with I do with each one um as well as um the elixir um code base that I'm going to be um doing the exorcism or the exorcism Kobe story not the electrical based the exorcism code based within the project as well. So let's click on this um go here. Perfect. So in this exercise you're going to write some code to help you cook a brilliant lasagna from your favorite cooking book. You have five tasks are related to the time spent cooking the lasagna to find the lasagna dot expected minutes in oven method that does not take any arguments. Okay, so let's start with that lasagna. The library lasagna. Okay, so def expected minutes and oven and returns how many minutes the lasagna should be In the oven according to the cookbook. The expected oven time in minutes is 40. Okay, so we're just gonna return 40 which is simple enough. Ok, so define the lasagna remaining minutes in oven a method that takes the actual minutes to lasagna has been in the oven as an argument and returns how many minutes the lasagna still has to remain in the oven based on the expected oven time in minutes from the previous task Do they want us to use the function or do they want us to just use 40 returns how many minutes lasagna sellers to remain in the oven based on the expected oven time minutes. Yeah I'm thinking they just want us to use 40. Um So we will do f leaning units in the oven time to We're gonna do 40 okay, see if that works okay um calculate the preparation time in minutes, define lasagna preparation time in minutes method that takes the number of layers you added to the lasagna as an argument and returns how many minutes you spend preparing lasagna. Each lasagna is assuming each layer takes you two minutes to prepare. Okay so Mhm. Oh my gosh I'm butchering this preparation time in minutes layers. Yeah and then we're gonna do layers thanks to okay apparently the total working time in minutes to find lasagna total time of minutes. That takes two arguments. The first argument is the number of layers you added to the lasagna and the second is the number of minutes Lasagna has been in the oven. Okay so we're gonna take start their death total time in minutes. We're gonna do the first is layers and the second is time. Oops for me. Okay, function should return how many minutes in total you've worked on cooking the lasagna which is the sum of the preparation time in minutes and the time in minutes. Lasagna has spent in the oven at the moment. Okay so I think it did want us to use this um so we're going to do lasagna dot it is out there players that too. So here we're gonna do, I actually don't know if we need to call the module because we're inside the module, assuming we're not going to call it because we're inside of it. So I'm just gonna do that and see how that works for us. Um Okay, so how many minutes in total you've worked on cook lasagna some of the preparation time in minutes and the time in minutes sonya spent in the oven. So we're going to do Mhm Okay, preparation time a minute with players as it's plus this argument plus remaining have an oven with time as its argument, create a notification that the lasagna is ready so we'll do deaf alarm you. I think the message indicating the lasagna is ready to eat. Thanks. Okay, so now we are going to do lasagna. God, I guess I don't need to call it. I just need to define it. This is the fine. Yes. Okay, um I forgot how to do the test treat me. You have running the test could help. Okay, next test. So something this Revenue has three failures. Okay, so the first one failed. Past past past past past so we have total time in minutes failed. Mhm. Why? Okay, so We did one and 30 Should be equal to 32. Oh it's equal to 32 and it should be equal to 16. Okay so remaining time in the oven preparation time in minutes plus remaining time and oven I feel like that should be correct me if I did something wrong there? Three and 20 difficult there's times too. Okay so the total time in minutes failed and the alarm failed. The 40. Okay so we're only getting 12. If we have one in 30 we're getting 12. Whoa why? Okay, let me see here. 12. So we have one and 30. I wonder if I need to like really Okay implicitly return an integer. No that should be fine. Okay hold on let's go back here because this passes which is the sum of the preparations time in minutes and the time in minutes. The lasagna has spent in the oven at the moment. Oh okay. The second argument. The number of minutes lasagna has been in the oven plus expected minutes in the oven. Wonder if I can do this. I just needed exclamation mark here. Okay, let's try this again. Okay, so that was, that was the issue, we wanted to take it away. So the total time left and I just mixed the exclamation park. So awesome. So now I just go um when I'm done putting tests useful submitting your solution and okay. All right, that one was a reading error which is totally fine. So that makes perfect sense
352 Views 0 Likes 0 Comments

I finished the third lesson of the Elixir Series and practice functions by tackling the "Lasgna" exercise on Exercism.

Comment
Leave a comment (supports markdown format)