Created
January 3, 2009 10:34
-
-
Save oki/42823 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def scan(text) | |
| text =~ /^([0-9]{1,2})[-\.]([0-9]{1,2})[-\.]([0-9]{4})/ | |
| end | |
| loop do | |
| loop do | |
| puts "Podaj pierwsza date (format: dd-mm-rrrr)" | |
| if scan(d1 = gets.chop!) | |
| break | |
| end | |
| end | |
| loop do | |
| puts "Podaj druga date (format: dd-mm-rrrr)" | |
| if scan(d2 = gets.chop!) | |
| break | |
| end | |
| end | |
| puts "OK, obie daty sa poprawne" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment