181.08 KB, 下载次数: 63
alexncf125 发表于 2021-3-22 14:41
class Game_Interpreter
def jjns(level = 23.3)
result = [10, 30, 60, 100, 150]
ppspssss 发表于 2021-3-22 14:18
要and和括号
if (1
ppspssss 发表于 2021-3-22 14:18
要and和括号
if (1
enghao_lim 发表于 2021-3-22 23:17
1. 运算符只有左边与右边,不是左边,中间,右边。
2. ruby括号非必要,主要问题还是出在(1)。
enghao_lim 发表于 2021-3-22 23:17
1. 运算符只有左边与右边,不是左边,中间,右边。
2. ruby括号非必要,主要问题还是出在(1)。
def jjns
if 1<=level and level<=10
jjns = 10
end
if 11<=level and level<=20
jjns = 30
end
if 21<=level and level<=30
jjns = 60
end
if 31<=level and level<=40
jjns = 100
end
if 41<=level and level<=50
jjns = 150
end
return jjns
end
enghao_lim 发表于 2021-3-24 20:55
首先,函数必须返回值不然调用会返回nil。
其次,比起把jjns放在game_batller,它更适合game_actor。
enghao_lim 发表于 2021-3-24 20:55
首先,函数必须返回值不然调用会返回nil。
其次,比起把jjns放在game_batller,它更适合game_actor。
enghao_lim 发表于 2021-3-24 20:55
首先,函数必须返回值不然调用会返回nil。
其次,比起把jjns放在game_batller,它更适合game_actor。
enghao_lim 发表于 2021-3-22 23:17
1. 运算符只有左边与右边,不是左边,中间,右边。
2. ruby括号非必要,主要问题还是出在(1)。
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |