Conditionals in Ruby Discussion
Feels a bit basic, but maybe that's a sign that I'm not exactly a beginner.
Basic is the idea here ๐ but you're probably also correct in your knowledge self-assessment, Daniel. That's great if that is the case!
if you wanted to add another service in the PASSWORD_VAULT, would that be a nested hash right? how would that look?
Hey Marissa,
Yep exactly right! The hash itself would look something like this:
PASSWORD_VAULT = {
"service one" => {
"username" => "Collin",
"password" => "supersecret"
},
"service two" => {
"username" => "other_collin",
"password" => "supersupersecret"
}
}
Hey Collin, thanks!
I remember to have seen a one line if statement that evaluates only one thing, for instance if this is not true do this, without providing else. Is that possible or I am mixing languages up?
Hey Alessandro,
You can absolutely do just a single if
without an else
clause in it. You have two forms that you can write such conditionals. The first is the traditional style, for example:
if true
puts "Hello, world!"
end
The second being the modifier form, which allows you to write such conditionals on a single line like so:
puts "Hello, world!" if true
Hope that helps!
The Ruby extension in the video is now deprecated. VSCode recommends Ruby LSP from Shopify. Do you recommend that as well now or something else?
I would also recommend the Ruby LSP from Shopify if you're going to be using VSCode. They are putting a lot of work into that and it seems that that work is only going to continue and the extension become better and better.
This was really cool. I loved this. Seems like it was perfect timing and fit nicely with the rest of the stuff. Really pus everything we've learned into the proper perspective. Too many teaching platforms only show you snippets and not a full program but I think that is literally what has left too many gaps and questions in my learning making me have to forever try to keep digging up more info until I could piece it all together myself, which as you could probably imagine, just was not happening!! Putting this together beginning to end did the trick. Real word examples of a full program with working code. Awesome. Thank you so much for this. I can't wait to get my hands dirty in the rest of the course and all the Rails courses this site offers. If all he other material is like this one I am sure I will learn a lot.
Hey Jessica! Thank you so much for the extremely kind words regarding this lesson! Your comment made my day and I'm very happy to hear that showing things in the context of an actual project really made it click for you. As we add more lessons to this path, I will keep this in mind and try to continue showing and exploring concepts in this way.