Project1
标题:
计算变量的写法
[打印本页]
作者:
黑之翅膀
时间:
2011-10-27 02:28
标题:
计算变量的写法
本帖最后由 黑之翅膀 于 2011-10-27 02:31 编辑
计算:
+ (加)
- (减)
* (乘)
/ (除)
% (取余数)
加法:
1.
a = a + b
复制代码
2.
a = 1
b = 5
a = a + b
复制代码
(a = 6)
3.
$game_variables[a] = 1
$game_variables[b] = 2
$game_variables[a] = $game_variables[a] + $game_variables[b]
复制代码
($game_variables[a] =3)
4.
a = 1.0
b = 2.0
a = a + b
复制代码
(a = 3.0)
a = 1.0
b = 2
a = a + b
(a = 3.0)
5.
$game_variables[a] = 5
$game_variables[b] = 2
$game_variables[a] = $game_variables[a] * 1.0
$game_variables[a] = $game_variables[a] + $game_variables[b]
复制代码
($game_variables[a] = 6.0)
6.
a = 1
b = 2.5
a = a + b
复制代码
(a = 3.5)
作者:
各种压力的猫君
时间:
2011-10-27 02:30
你在干嘛 = = b
作者:
黑之翅膀
时间:
2011-10-27 02:34
a = 3.5
a = a.round
(a = 4)
round 四舍五入
a = 3.5
a = a.to_i
(a = 3)
to_i 取整
对不起,我写错地方了...
作者:
summer92
时间:
2011-10-27 10:23
+,-,*,/,,mod,rand,to_i,to_s,.is_a? 就这么多 觉得好 加个分
summer92于2011-10-27 13:43补充以下内容:
怎么个详细法?常用的就这么多
作者:
fux2
时间:
2011-10-27 14:47
a+=b不可以吗.
作者:
hcm
时间:
2011-10-27 15:47
4.=3,6.=3.5
这次讨论的目的是什么?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1