Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add koan on break statements

  • Loading branch information...
commit a05d7b8980412a099b3848343b098461dd75c58c 1 parent 70eae5b
@calavera calavera authored
Showing with 20 additions and 0 deletions.
  1. +10 −0 koans/about_control_statements.rb
  2. +10 −0 src/about_control_statements.rb
View
10 koans/about_control_statements.rb
@@ -93,6 +93,16 @@ def test_break_statement
assert_equal __, result
end
+ def test_break_statement_returns_values
+ i = 1
+ result = while i <= 10
+ break i if i % 2 == 0
+ i += 1
+ end
+
+ assert_equal __, result
+ end
+
def test_next_statement
i = 0
result = []
View
10 src/about_control_statements.rb
@@ -93,6 +93,16 @@ def test_break_statement
assert_equal __(3628800), result
end
+ def test_break_statement_returns_values
+ i = 1
+ result = while i <= 10
+ break i if i % 2 == 0
+ i += 1
+ end
+
+ assert_equal __(2), result
+ end
+
def test_next_statement
i = 0
result = []
Please sign in to comment.
Something went wrong with that request. Please try again.