Skip to content

Commit

Permalink
Ruby: Project: Caesar Cipher: Fix Ruby Caesar Cipher code example (#2…
Browse files Browse the repository at this point in the history
…9107)

* Caesar_cipher code example showed right shift, not left.

A left shift of 5 for the string "What a string" should yield the value "Rcvo v nomdib!". The output in the example shows a right shift of 5.

At the very least, the example from Wikipedia shows a left shift of three, "D->A" and "E->B" while the code example shows a right shift. The examples should be consistent on the page.

* Add instructions for right shift

* Add to project instructions using a right shift
* Add to quick tips that Wikipedia shows a left shift
* Fix lower case ceaser
  • Loading branch information
JeffreyMPrice authored Nov 25, 2024
1 parent c07bfa1 commit 209f84b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ruby/basic_ruby_projects/project_caesar_cipher.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Harvard's CS50 class has a [video about the Caesar cipher](https://www.youtube.c

<div class="lesson-content__panel" markdown="1">

Implement a caesar cipher that takes in a string and the shift factor and then outputs the modified string:
Implement a Caesar cipher that takes in a string and the shift factor and then outputs the modified string using a right shift:

```ruby
> caesar_cipher("What a string!", 5)
Expand All @@ -30,5 +30,6 @@ Harvard's CS50 class has a [video about the Caesar cipher](https://www.youtube.c
- You will need to remember how to convert a string into a number.
- Don't forget to wrap from `z` to `a`.
- Don't forget to keep the same case.
- The Wikipedia quote discusses a Caesar cipher using a left shift.

</div>

0 comments on commit 209f84b

Please sign in to comment.