Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"in" keyword in Ruby

Name: Anonymous 2010-03-21 16:00

Can anyone tell me what the "in" keyword is for?

I piped the users "input" (from gets) into a block, so I had
{ |in| in ..doing some shit la la la.. }
Ruby promptly threw a SyntaxError, saying that it wasn't expecting kIN.

I find plenty of documentation saying it is a reserved keyword, but I can't find a single example of what "in" does...

Name: Anonymous 2010-03-21 16:04

Same as python I'd imagine
[Anonymous@/prog/ ~]$ irb
irb(main):001:0> for i in [1,2,3] do puts i end
1
2
3
=> [1, 2, 3]
irb(main):002:0>

Name: Anonymous 2010-03-21 16:08

Ahh so it helps use the for loop to iterate over arrays, thank you kind anon, this has been bugging me all day

I am reading the Poignant guide, and they glossed over for loops in the loop section (they focus on while, and the loop methods like .each, instead of beautiful for constructs)

Name: Anonymous 2010-03-21 16:11

Poignant guide
HAHA OH WOW

Name: Anonymous 2010-03-21 16:26

[b][s][o][u]DICKS[/b][/s][/o][/u]

Name: >>2 2010-03-21 16:35

>>4
It's not bad, I even think that it has a certain charm to it, but it was unable to convince me that ruby was worth my time.

Name: Anonymous 2010-03-21 17:10

>>3
I'm no Rubby expert, but I'm guessing it works with any Enumerable.

Name: Anonymous 2010-03-21 17:45

|in| is not a keyword, it's a variable

http://www.skorks.com/2009/09/using-ruby-blocks-and-rolling-your-own-iterators/

blocks are basically anonymous functions -- in this case, yours takes "in" as a parameter

Name: Anonymous 2010-03-21 23:01

>>7
I'm no Anus expert, but I'm guessing it works with any Haxable.

Name: Anonymous 2010-03-22 17:47

>>4
What happened to the guy after his digital suicide anyway?

Name: Anonymous 2010-03-22 18:33

>>10
Alive and well.

Name: Anonymous 2010-03-22 18:54

>>11
Ironic!

Name: Anonymous 2010-03-22 20:03

>>9
Go eat cheeseburgers Randy!

Name: Anonymous 2010-03-22 21:07

>>9
I think you are misguided. An Anus doesn't work with any Haxable. It is a Haxable. If on the other hand, you were to say 'It works with any Haxxor' I'd agree with you.

Name: Anonymous 2010-03-22 22:10

>>14
I think you are replying to yourself.

Name: Anonymous 2010-03-22 22:10

Anyways, >>1, please listen to me. That it's really related to this thread.
I went to Yoshinoya a while ago; you know, Yoshinoya?
Well anyways there was an insane number of people there, and I couldn't get in.
Then, I looked at the banner hanging from the ceiling, and it had "150 yen off" written on it.
Oh, the stupidity. Those idiots.
You, don't come to Yoshinoya just because it's 150 yen off, fool.
It's only 150 yen, 1-5-0 YEN for crying out loud.
There're even entire families here. Family of 4, all out for some Yoshinoya, huh? How fucking nice.
"Alright, daddy's gonna order the extra-large." God I can't bear to watch.
You people, I'll give you 150 yen if you get out of those seats.
Yosinoya should be a bloody place.
That tense atmosphere, where two guys on opposite sides of the U-shaped table can start a fight at any time,
the stab-or-be-stabbed mentality, that's what's great about this place.
Women and children should screw off and stay home.
Anyways, I was about to start eating, and then the bastard beside me goes "extra-large, with extra sauce."
Who in the world orders extra sauce nowadays, you moron?
I want to ask him, "do you REALLY want to eat it with extra sauce?"
I want to interrogate him. I want to interrogate him for roughly an hour.
Are you sure you don't just want to try saying "extra sauce"?
Coming from a Yoshinoya veteran such as myself, the latest trend among us vets is this, extra green onion.
That's right, extra green onion. This is the vet's way of eating.
Extra green onion means more green onion than sauce. But on the other hand the price is a tad higher. This is the key.
And then, it's delicious. This is unbeatable.
However, if you order this then there is danger that you'll be marked by the employees from next time on; it's a double-edged sword.
I can't recommend it to amateurs.
What this all really means, though, is that you, >>1, should just stick with today's special.

Name: Anonymous 2010-03-22 22:29

>>15
I think you are raping yourself.

Name: not >>15 2010-03-22 22:54

>>17
I don't think one can do that to oneself.
Let's look at some definitions of the world:
Sexual assault is an assault of a sexual nature on another person.

Rape, also referred to as sexual assault, is an assault by a person involving sexual intercourse with or without sexual penetration of another person without that person's consent.

This means one cannot rape oneself by definition.

If we ignore the ``another person'' requirement in the definition, let us examine the meaning of the remaining definition:

Rape, also referred to as sexual assault, is an assault by a person involving sexual intercourse with or without sexual penetration without that person's consent.

The lack of consent is another requirement. Since one has to premeditate the fact about what one is about to do to oneself, that implies giving consent to oneself, thus that part of the definition cannot apply, nor can the assualt part as it's consentual.

Thus the definition that remains is:
Rape is sexual intercourse with or without sexual penetration.

Oh wait, the definition of ``sexual intercourse'' says:
Sexual interaction, usually involving genital and/or anal and/or oral penetration, between at least two organisms
That doesn't work, as there is only one person involved in the act. If you remove that requirement, you end up with the definition of masturbation.

In simplest terms, you are implying >>15 is fapping, which doesn't seem to me like much of an accusation, compared to his accusation calling >>9 and >>14 the same person, which seems much more likely.

Name: Anonymous 2010-03-22 23:15

>>18

I masturbate, even though I hate doing it (it drains me of my energy).

Does that count as rape?

Name: Anonymous 2010-03-22 23:24

>>19
If you truly wouldn't want it, you wouldn't do it, but one might not be able to ignore various physical needs one might have, but there is always a choice, thus it cannot be rape.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List