X
x1
Is something like this possible?
asdf = {"letters" => |||||some code that returns something|||||}
This is difficult for me to explain being that im not a "programmer"
but.. here's what im trying to do:
asdf = {"letters" => (if 1+1 == 3; return "yes";else return "no";end)}
### in hopes that this would set asfd['letters'] equal to "no"
or.. something like this:
asdf = {"letters" => ["a", "b", "c"].each {|letter| yield letter if
letter != "b"}}
### in hopes that asdf['letters'] will equal ["a", "b"]
i realize, I could do ["a", "b", "c"].delete("b") but my question is
can you define the value of a hash based on an iteration, or an if
statement etc..
Thank you
asdf = {"letters" => |||||some code that returns something|||||}
This is difficult for me to explain being that im not a "programmer"
but.. here's what im trying to do:
asdf = {"letters" => (if 1+1 == 3; return "yes";else return "no";end)}
### in hopes that this would set asfd['letters'] equal to "no"
or.. something like this:
asdf = {"letters" => ["a", "b", "c"].each {|letter| yield letter if
letter != "b"}}
### in hopes that asdf['letters'] will equal ["a", "b"]
i realize, I could do ["a", "b", "c"].delete("b") but my question is
can you define the value of a hash based on an iteration, or an if
statement etc..
Thank you