<r3m>
havenwood: sorry was testing something in weechat and the command is -include=#channel not -include #channel so i amsg al the chan, kind of embarassing ;)
LtHummus has joined #ruby
<mnathani>
is it possible to have a " within a string?
gell5 has joined #ruby
<havenwood>
mnathani: Yeah, you can have any character supported by the encoding in a String.
<havenwood>
mnathani: When you wonder, try in IRB.
<havenwood>
?irb mnathani
<havenwood>
irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
<havenwood>
mnathani: IRB ships with Ruby. Type "irb" from your command line.
<mnathani>
&>> "mnathani"here"
<rubydoc>
stderr: -e:4: syntax error, unexpected local variable or method, expecting `end'... check link for more (https://carc.in/#/r/9ek4)
<apotheon>
The parser might be checking the syntax of the program and taking note of specific things that need handling, such as creating a variable, then after doing that sort of thing in a wave or two it might go back and assign values.
<apotheon>
. . . so upon first parsing it, it just sets aside the storage for the variable, then later (when evaluating whatever produces the value to be assigned to the variable) actually sticks something in that storage space.
<apotheon>
I say this without actually looking at that page, though, so maybe I'm mistaken.
<al2o3-cr>
apotheon: that's pretty much correct.
<apotheon>
thanks for confirmation
<al2o3-cr>
as soon as the ruby parses an expression with an assignment a local variable is created, whether that expression evaluted to true or false.
<mnathani>
a = 10 vs if a < 10 ?
<al2o3-cr>
mnathani: one is an assignment the other is a condition.
<mnathani>
what would a good example for an expression look like
<al2o3-cr>
mnathani: both are expressions.
<apotheon>
10 is an expression that evaluates to 10, actually.
<apotheon>
a = 10 is a more complex expression (and also evaluates to 10)
<mnathani>
so this part still gets me : ` not when the assignment occurs `
<apotheon>
a < 10 evaluates to either true or false, unless a doesn't exist, in which case you get a nice error
<al2o3-cr>
operands and operators.
arzWZM has quit [Ping timeout: 265 seconds]
<mnathani>
whats the difference between encountering an assignment vs an assignment occuring
<apotheon>
mnathani: On the first pass when it finds `a = 10`, it sets aside storage for a local variable.
<apotheon>
mnathani: On a later pass when it evaluates the `10` part, it assigns the results to that storage.
arzWZM has joined #ruby
<apotheon>
This is when the parsing and execution occurs behind the scenes. The Ruby interpreter/VM is doing this stuff; it doesn't correlate directly to the way we humans read the code.
<mnathani>
its like minute details? not to be concerned about for beginners?
<apotheon>
pretty much
<mnathani>
good to know. Thank you
<apotheon>
I've never read that page of documentation.
kinduff has joined #ruby
<apotheon>
mnathani: glad to help
<al2o3-cr>
mnathani: just be mindful of precedence when assigning
<al2o3-cr>
mnathani: `&&` is a control flow operator `and` is a keyword
<al2o3-cr>
basically `and` is short-circuit boolean
<al2o3-cr>
lower than `&&`
troulouliou_dev has quit [Quit: Leaving]
<al2o3-cr>
what would call && a control flow op or logical op?
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
hiroaki has joined #ruby
gell5 has joined #ruby
hiroaki has quit [Remote host closed the connection]
hiroaki has joined #ruby
gell5 has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
<mnathani>
sorry .. not sure what you are asking?
cacheerror has quit [Quit: WeeChat 2.8]
wake_of_ship has quit [Ping timeout: 246 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
ChmEarl has joined #ruby
<adam12>
mnathani: Kinda like bedmas I guess.
<adam12>
mnathani: My suggestion is to try to prefer && and || almost always, `and` and `or` infrequently.
<adam12>
mnathani: At least until you understand the difference in precedence.
<apotheon>
Bedmas?
<apotheon>
Is that the celebration of the birth of Bed?
<adam12>
lol
<apotheon>
I prefer "and" and "or", probably because I don't often find myself operating directly on the result of a conjunction or disjunction like that, but I do sometimes need to perform some operation after seeing how a previous operation works out.
<apotheon>
also probably because I like the English-language-ness of them
<adam12>
apotheon: I think it's fine if you're experienced but if you're learning it can add some confusion.
troulouliou_dev has joined #ruby
<apotheon>
I think the "new user" guidance might better be something like "Use parentheses around conjunction/disjunction expressions."
<apotheon>
(then delete them later when you're more comfortable with the language)
<al2o3-cr>
be nice if `and` and `or` be made operators.
<phaul>
mnathani: here foo seems to magically switch between two values
<apotheon>
phaul: That's insidious.
<apotheon>
well played
<phaul>
hehe :)
alfiemax has joined #ruby
<apotheon>
How does one create a periodic meatspace interest group gathering at a public place that people can reasonably stumble onto, express intent to attend, and attend, without using or relying on Meetup or Facebook?
alfiemax has quit [Ping timeout: 264 seconds]
Emmanuel_Chanel has quit [Quit: Leaving]
<mnathani>
does a return statement leave the method it was executed in?
<leah2>
yes
<mnathani>
whats the difference between segmenting code within a begin / end block within a method definition, and just skipping the begin / end portion?
<leah2>
usually begin/end is used with rescue
<leah2>
(but there is an implicit begin/end actually)
<leftylink>
second most common place one would see begin/end is probably with ||=
<leah2>
or begin..end until ...
cliluw has joined #ruby
<leah2>
leftylink: i'd use () there probably
<leftylink>
nice
<leftylink>
in fact, I think I had not thought of doing that...
<leftylink>
I will have to keep this in mind as a possibility