Skip to content

Instantly share code, notes, and snippets.

@konfou konfou/do-until.jl
Created Oct 31, 2017

Embed
What would you like to do?
"""
@do begin
body
end when condition
Macro emulating a do-until construct.
"""
@eval macro $(:do)(body, when::Symbol, condition)
quote
while true
$body
if $condition break; end;
end
end |> esc
end
% way 1
while true
$body
if not ($condition) break; end
end
% way 2
function body
$body
end
%do
body
while $condition; body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.