a = ["B","A","C","B","A"]
a.each do |n|
if a[0] == n
puts "Match"
end
end
It should work with the card stuff. Issue I’m having is having the first card compare to itself. Is there a way to adjust when n would start from? Or should I do it a different way?
Oh yeah: I’ve been doing it this way for a while now. By this way I mean trying out simpler code elsewhere and then trying to fit into my cards project. Is that fine?
I’ve tried a few things to help my energy: having a consistent sleep schedule (I’ve done this successfully for some time periods, no long-term consistency), eating healthier, exercising, quitting caffeine, increasing my nutritional intake, quitting vaping, and trying out various supplements. While I think certain things have had some success I wonder how much of my health has been affected by mold.
We recently got our roof repaired and thought that those leaks, due to the damaged roof, were the cause of water damage in the house. Some were. Others were not. We’ve had a pipe leaking and doing crazy amounts of water damage. Apparently the plumbers said all the houses in my neighborhood were built with it. Its so bad that you are no longer allowed to build with the stuff since ~1980 smth.
Anywaeys just seeing how much mold we actually have was insane. My moms whole walk-in closet was covered in black mold. We had black mold go into our bathroom but my mom painted it. I don’t know why I never made the connection about how the mold affected me until I saw just the sheer volume of mold we have. I’ve changed moldy shower curtains before in the past and noticed myself feeling much better. I think because I’m so used to the mold surrounding my bathroom (and probably cause it feels so far) that I never thought it could affect me.
Luckily, after dealing with some lying by our insurance company and threatening to go to a lawyer and some other stuff they agreed to cover all the damage. Should be more-or-less mold free within a few weeks or so. I wonder if I’ll notice a difference?
For the Duolingo assignment you mentioned in Elliot's Microblogging - #253 by Elliot I went ahead and chose Japanese because I have been studying it for a while already. Just a few questions:
Would my prior knowledge be a problem for this kind of thing?
Roughly how I study Japanese daily so far is to:
Do writing lessons and reviews. Roughly write about 20 characters a day.
Grammar flashcards
Vocabulary flashcards (regular recall ones and type in the answers)
an episode of anime in Japanese
I bring those up because I wonder if those count as practice. I don’t mind adding 15 minutes of DuoLingo on top of that. From what I read the assignment wasn’t given as a requirement just a recommendation but I don’t mind doing it. Will I get benefits from doing it? I feel like the stuff duo had me do so far is similar to my reviews and stuff. Should I do a different language?
I think trying Duo is a good idea for you, but if it ends up too similar you could stop earlier than a month. Try another language for a couple days so you can compare to Duo Japanese.
Last lesson we looked at how we can give methods information through parameters. In this tutorial we will be looking at how methods can give us information back.
You can put “return” in your method to define what you want to have returned when calling on a function.
Even though the code isn’t “done” by putting return earlier on in the method ruby does not run the remaining code in a function after the return.
You can return multiple values.
Have twenty or so videos left. After I finish them I plan to go through the Ruby | The Odin Project you mentioned before.
not exactly. you can return an array that holds multiple values, but the array is itself a single value that’s returned. also ruby has some syntax shortcuts that can make it look more like returning multiple values.
Hmm. So I just realized: do the parameters determine where the inputs go? By that I mean in:
def rank_to_number(rank)
# J = 11, Q = 12, K = 13, A = 14. For now we'll ignore how A can sometimes be 1.
rtn = {"A" => 14, "J"=> 11, "Q"=>12, "K"=>13,"T"=>10, "2"=>2, "3"=>3, "4"=>4, "5"=>5 , "6"=>6, "7"=>7, "8"=>8, "9"=>9}
print rtn[rank]
end
I kept thinking that the "rank) in the parentheses referred to an array or something. To put it differently I thought what that string of words is mattered. I though “rank” had a coding reason to be named rank. The code could work just as well with “rank” being renamed as “lemon”. Right?
Also if I move around “rank” in the code it will put in that input at that spot. I guess thats obvious but I was bit confused thinking that if I don’t put in a rank array or something in the rank spot it shouldn’t run.
I watched three giraffe academy videos. The last one was a simple calculator he put together with puts, gets, and if statements. Nothing covered to note. Here’s my notes from the other two:
For an if statement that is dealing with boolean values (true or false) by default an if statement will look to see if the value/variable with a value is true. You can set it up to run while false but by default it has to run when true.
You can check for two boolean values (and maybe more?) by simply using the word “and”. Something along the lines “if true and true”
“or” if one of the values is true
! = not
I assume this follows the truth table stuff I did before.
The good news is that remorse is often genuine; the bad news is that it rarely helps.
Something I relate to. I often feel genuine remorse for some things I’ve done and I’ve mentioned before how I think that remorse is a substitute for dealing with the stuff I did.
Hmm. That sucks. I’m kinda surprised to hear that corporate law firms are being affected. I wonder how far this stuff will spill.
I wonder if part of the reason for inaction is because, regardless of how bad things maybe are (I don’t know I haven’t been keeping up), companies are just used to pressure from the government.
def find_pair(hand)
# return rank (as 1-character string) of highest ranked pair in hand
You’re just printing match not saying what rank the pair is.
Anyway, I think breaking it down into simpler parts is the key. When stuff is hard, confusing, too complicated, etc., looking for ways to deal with sub-parts is generally the most important thing to try.
This seems to come up quote often and I don’t disagree with it. Do you have any assignments (besides obviously what we are working on right now) that I could to practice breaking something up into simpler parts?
Yes, Thats also why I started my project of posting consistently. I noticed I forget a lot of details due to some of the long breaks I take. My goal is to try and even work a little bit daily so I don’t forget stuff so often. I could, alternatively, also work on maybe noting some of the stuff better? So I have access to it more often?