Permalink
Browse files

Add koan on break statements

  • Loading branch information...
calavera committed Jan 23, 2011
1 parent 70eae5b commit a05d7b8980412a099b3848343b098461dd75c58c
Showing with 20 additions and 0 deletions.
  1. +10 −0 koans/about_control_statements.rb
  2. +10 −0 src/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 = []
@@ -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 = []

0 comments on commit a05d7b8

Please sign in to comment.