Skip to content

Jerry Samuels Jr.#33

Open
DiwthL83 wants to merge 1 commit intoomahacodeschool:masterfrom
DiwthL83:master
Open

Jerry Samuels Jr.#33
DiwthL83 wants to merge 1 commit intoomahacodeschool:masterfrom
DiwthL83:master

Conversation

@DiwthL83
Copy link

Submitting the numbers part of the 05/29/16 assignment

(result) 100

Non-working Code:
(my code) puts 5*'20'
Copy link

@halfghaninne halfghaninne Jun 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting! I didn't realize order mattered here.

Try running '20'*5. Does this operation still work, even if it doesn't work the way we'd expect/hope it to?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will work, because it's reading the operation as you asking the compiler to put the string "20" in the results five times. IT resolves to:

2020202020
=> nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments