mar*_*cog 7

有很多这样的工具.Stack Overflow使用google-code-prettify.如果你喜欢这里发布的代码格式,你可能想要使用.Ruby示例:

<pre class="prettyprint lang-ruby">
def sum(n)
    result = 0
    i = 1
    while i <= n
        result += i
        i += 1
    end
    return result
end
</pre>
Run Code Online (Sandbox Code Playgroud)

结果将如下所示:

def sum(n)
    result = 0
    i = 1
    while i <= n
        result += i
        i += 1
    end
    return result
end
Run Code Online (Sandbox Code Playgroud)