This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
david1234vo's profile picture

deviding variabless

Started by david1234vo, 14 March 2014 - 08:46 PM
david1234vo #1
Posted 14 March 2014 - 09:46 PM
how do you devide 2 variables,

for example (this did NOT work :-))


c=50
p=2
c/p = m
print(m)

my intention was that m == 25 but it just sayd

bios:339: [string "devide"]:4: '=' expected

(my program is called devide)
Lyqyd #2
Posted 15 March 2014 - 12:35 AM
Assignment operations must always go the correct direction. You tell Lua what to put the result in, then tell it the value to put in it. Change your division operation to be assigned to m instead and it should work:


m = c/p