Oxygen Basic
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Latest OxygenBasic.zip at GitHub
(Click on the Wizard)
Home
Help
Search
Login
Register
Oxygen Basic
»
Programming
»
Bugs & Feature Requests
»
:= not working as thought
« previous
next »
Print
Pages: [
1
]
Author
Topic: := not working as thought (Read 2313 times)
0 Members and 1 Guest are viewing this topic.
kryton9
Guest
:= not working as thought
«
on:
June 27, 2011, 07:37:59 PM »
Code: Text
'Error when using := with if statements. I thought we were supposed to use them with those?
'this part works
int x, y
y = 0
string s = ""
for x = 1 to 25
y++
if y = 20 then
y = 0
end if
s+= "x " x " y " y chr(10) chr(13)
next
print s
'this doesn't work
quad i, j
j = 0
s = ""
for i = 1 to 25
j++
if j := 20 then
j = 0
end if
s += "i " i " j " j chr(10) chr(13)
next
print s
'this works
j = 0
s = ""
for i = 1 to 25
j++
if j = 20 then
j = 0
end if
s += "i " i " j " j chr(10) chr(13)
next
print s
Logged
Charles Pegge
Guest
Re: := not working as thought
«
Reply #1 on:
June 27, 2011, 08:58:23 PM »
it assigns the value of right hand expression to j then makes a zero / nonzero evaluation on the right hand expression and procedes if non zero.
if j := 20
Charles
PS I see there is a problem with assigning to quads in this way
«
Last Edit: June 27, 2011, 09:23:32 PM by Charles Pegge
»
Logged
Print
Pages: [
1
]
« previous
next »
Oxygen Basic
»
Programming
»
Bugs & Feature Requests
»
:= not working as thought