mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Added swap example to parallel assignments
This commit is contained in:
@@ -35,4 +35,11 @@ class AboutArrayAssignment < EdgeCase::Koan
|
|||||||
assert_equal __("John"), first_name
|
assert_equal __("John"), first_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_swapping_with_parallel_assignment
|
||||||
|
first_name = "Roy"
|
||||||
|
last_name = "Rob"
|
||||||
|
first_name, last_name = last_name, first_name
|
||||||
|
assert_equal __('Rob'), first_name
|
||||||
|
assert_equal __('Roy'), last_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user