Skip to content

Instantly share code, notes, and snippets.

@konfou
Last active March 18, 2021 22:43
Show Gist options
  • Select an option

  • Save konfou/a95e6b680b8261ae35fa2bd27a255aa1 to your computer and use it in GitHub Desktop.

Select an option

Save konfou/a95e6b680b8261ae35fa2bd27a255aa1 to your computer and use it in GitHub Desktop.

Revisions

  1. konfou revised this gist Mar 18, 2021. No changes.
  2. konfou revised this gist Mar 18, 2021. 1 changed file with 0 additions and 17 deletions.
    17 changes: 0 additions & 17 deletions do-while.m
    Original file line number Diff line number Diff line change
    @@ -1,17 +0,0 @@
    % way 1

    while true
    $body
    if not ($condition) break; end
    end

    % way 2

    function body
    $body
    end

    %do
    body
    while $condition; body
    end
  3. konfou created this gist Oct 31, 2017.
    15 changes: 15 additions & 0 deletions do-until.jl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    """
    @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
    17 changes: 17 additions & 0 deletions do-while.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    % way 1

    while true
    $body
    if not ($condition) break; end
    end

    % way 2

    function body
    $body
    end

    %do
    body
    while $condition; body
    end