[ruby] drill output

Contents

Question 1 Let's create a function to enter a name. If there is a period (.) Or a space other than the name, an error will be displayed.

Tips Use the include? method.

include? The include? method is a method that determines whether the specified element is included in an array or character string. image.png Screenshot 2020-08-14 16.50.22.png

Implementation

image.png

Commentary

If there is (.) Or () in str, it is OK if you make a conditional branch with include? So that you can not register.

Recommended Posts

[ruby] drill output
[ruby] drill output
[ruby] drill output
[ruby] drill output
[ruby] drill output
[ruby] drill output
[ruby] drill output
Ruby input / output
Ruby calorie calculation output
Output triangle in Ruby
[Ruby on Rails] CSV output function
String output method memo in Ruby
Ruby learning 4
[Ruby] Array
Ruby basics
Ruby Review 2
Ruby addition
Refactoring Ruby
Ruby learning 3
2020/10/4 Morning output
Ruby print puts p printf output method
2020/10/4 noon output
Learning output ~ 11/3 ~
Ruby setting 2
Ruby problem ⑦
2020/10/5 Morning output
Ruby learning 2
[Ruby] Block
Refactoring Ruby
ruby calculator
Ruby learning 6
Ruby settings 1
Refactoring Ruby
Learning output
2020/10/3 Noon output
Ruby basics
Ruby memo
Ruby learning 1
Ruby Review 1
From terminal to Ruby (standard input / output)
2020/10/3 Morning output
[Ruby] Module
Drill (self-made)
[Ruby] Difference between puts and return, output and return value