Last active
January 16, 2017 06:27
-
-
Save YSRKEN/cb1b4072e6b9c61710d2 to your computer and use it in GitHub Desktop.
【追記あり】使いやすいけど使いづらいプログラミング言語「HSP」について ref: http://qiita.com/YSRKEN/items/0c059abfb8685051cb16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mes 1+"1" ;2 | |
mes "1"+1 ;11 | |
mes 1+"1A" ;2 | |
mes 1+"A1" ;1 | |
mes 1+"1" ;1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim a, 3 | |
a(0) = 1 :a(1) = 2: a(2) = 3 | |
flg = 0 | |
if flg & a(4) > 0{ ;エラー! | |
mes "a" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim a, 3 | |
a(0) = 1 :a(1) = 2: a(2) = 3 | |
flg = 0 | |
if flg{ | |
if a(4) > 0{ | |
mes "a" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = "ABCDE" | |
mes instr(string,,"A") ;0 | |
mes instr(string,,"E") ;4 | |
mes instr(string,,"F") ;-1 | |
mes instr(string,1,"D") ;2 | |
mes instr("FGH",,"G") ;エラー「変数名が指定されていません」 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// モジュールを定義する(testはモジュール名) | |
#module test | |
// xと(グローバル変数の)bを足してそれを表示する(命令) | |
#deffunc mes_ab int x | |
c = x + b@ ;ちなみに、こことその次の行のcをaにすると | |
mes c ;エラー「パラメータ引数名は使用されています」が出る | |
return | |
// aを2乗してその値を返す(関数) | |
#defcfunc square int a | |
b = a * a | |
return b | |
#global | |
b = 3 | |
mes b ;3 言うまでもありませんね | |
mes square(5) ;25 これも問題ないはずです | |
mes b ;3 モジュール内の変数とは区別されます | |
mes b@test ;25 「変数名@モジュール名」とすれはアクセス可能 | |
mes_ab 5 ;8 「変数名@」とすればグローバル変数側も参照可能 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment