
Fiber::throw 메서드는 다른 Fiber로 throw를 할 때, throw하는 값을 받을 수 있는 방법은 Fiber::resume 메서드를 사용하는 것입니다.
Fiber::resume 메서드는 Fiber::throw로 throw된 값을 받을 수 있습니다.
Fiber::throw와 Fiber::resume를 함께 사용하는 예시는 다음과 같습니다.
#hostingforum.kr
ruby
fiber = Fiber.new do
Fiber.yield "Hello"
Fiber.yield "World"
end
puts fiber.resume # => "Hello"
puts fiber.resume # => "World"
위의 예시는 Fiber::throw가 호출되지 않았지만, Fiber::resume를 호출할 때마다 Fiber::yield로 throw된 값을 받을 수 있습니다.
Fiber::throw를 사용하는 예시는 다음과 같습니다.
#hostingforum.kr
ruby
fiber = Fiber.new do
throw "Hello"
throw "World"
end
puts fiber.resume # => "Hello"
puts fiber.resume # => "World"
위의 예시는 Fiber::throw로 throw된 값을 받을 수 있습니다.
Fiber::throw와 Fiber::resume를 함께 사용하는 예시는 다음과 같습니다.
#hostingforum.kr
ruby
fiber = Fiber.new do
throw "Hello"
Fiber.yield "World"
end
puts fiber.resume # => "Hello"
puts fiber.resume # => "World"
위의 예시는 Fiber::throw로 throw된 값을 받을 수 있습니다.
Fiber::throw와 Fiber::resume를 함께 사용할 때, throw하는 값을 받을 수 있는 방법은 Fiber::resume 메서드를 사용하는 것입니다.
Fiber::resume 메서드는 Fiber::throw로 throw된 값을 받을 수 있습니다.
Fiber::throw와 Fiber::resume를 함께 사용할 때, 예시는 위의 예시를 참고하시기 바랍니다.
2025-07-20 16:53