[英]Translating php to vba
please I need some help converting this php line into vba I don't need to validate $pre, I just need to compute the changes of any variables in this line (eg: $dx+=$ay..) 请我需要一些帮助,以将此php行转换为vba,我不需要验证$ pre,我只需要计算该行中任何变量的变化(例如:$ dx + = $ ay ..)
$pre = $dy % 2 && ($dx += $ay %2 ? 0.5 : -0.5);
so basically this is my attempt: 所以基本上这是我的尝试:
If (dy Mod 2) Then
If ((dx + ay) Mod 2) Then
dx = dx - 0.5
Else
dx = dx + 0.5
End If
End If
I ran some tests and it I don't get the same results with this vba code 我进行了一些测试,但此vba代码没有得到相同的结果
I think it should be: 我认为应该是:
If (dy Mod 2) Then
If (ay Mod 2) Then
dx = dx + 0.5
Else
dx = dx - 0.5
End If
End If
Seems like your second condition isn't correct. 似乎您的第二个条件不正确。 The PHP code says $ay %2
but your writing dx+ay % 2
PHP代码说$ay %2
但是您写dx+ay % 2
If (dy Mod 2) Then
If (ay Mod 2) Then
dx = dx + 0.5
Else
dx = dx - 0.5
End If
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.