STEP 6: Now we will use a loop to check each letter in our message. Let's set it up!

  • From , drag Loop through String indented inside the function.
  • Change "word" to message. The loop will iterate over each character or letter stored in the message variable.

While looping through each letter of message, we need to check whether that letter is in the alphabet. If it is, we can encrypt it! If it isn't, then it must be a symbol or a space, so we don't encrypt it.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)