Skip to content

Latest commit

 

History

History
95 lines (80 loc) · 2.17 KB

doc-Ch.md

File metadata and controls

95 lines (80 loc) · 2.17 KB

RickRoll 语言教程

一个“面向诱骗”的强动态、解释型脚本语言。

执行源码命令

用一般方法执行源代码:

python3 RickRoll.py [Source Code File Name]

将 .rickroll 翻译到 .cpp (C++): (需要G++编译器,而且此功能目前还不成熟,可能会出问题)

python3 RickRoll.py -cpp [Source Code File Name]

如果你想知道执行所耗时间:

python3 RickRoll.py [Source Code File Name] --time

利用RickRoll源码生成并播放一个音频(但此功能不算成熟,可能会出错)

python3 RickRoll.py [Source Code File Name] --audio

Hello World

take me to ur heart                            # 定义 Main 函数/方法
    give msg up "你 被 骗 了 !\n"              # 定义 msg 变量
    i just wanna tell u how im feeling msg     # 输出 msg 变量
say_good_bye                                   # 结束 Main 函数/方法

那么你的终端将会输出:

你 被 骗 了 !

定义变量

give a up 10                                   # 定义 a 变量并赋值为 10
give b up "It is a string"                     # 定义 字符串 b
give c up ["This", "is", "an", "array"]        # 定义 列表 c

If 语句

take me to ur heart~    # 你可以在语句后面加 “~”

    give a up 10

    and if u ask me how im feeling a is 10
        i just wanna tell u how im feeling "A is 10!"
    say goodbye

say_good_bye~

相当于以下Python代码

if __name__ == '__main__':
    a = 10
    if a == 10:
        print("A is 10!")

终端将会输出:

"A is 10!"

Loop 循环

take me to ur heart
    together forever and never to part # 死循环

    say goodbye

say_good_bye

等价于以下Python代码

if __name__ == "__main__":
    while True:
        pass

Function 函数

never knew func arg1, arg2 could feel this way  # 定义函数
    when i give_my arg1, arg2 it will be completely # 返回arg1和arg2
say goodbye

等价于以下Python代码

def func(arg1, arg2):
    return arg1, arg2