New to programming and need some help getting started ? - Well, then our tutorial section will help kick start your programming adventure.
If you're looking for more Source Code / Tutorials & Media ? - Then remember to visit the PlayBasic Resource board on our forums.
Found #2 items in Comparisons category by Kevin Picone
This question came in recently.. So here's a quick response on the subject. You can find more on the PlayBasic Help files (online link bellow)
What are ">=, >, <, <=, == , !=" all these and why would they need to get used?"
Most of those are comparison operators. So we use them to compare the terms on either side of the operator.
>= compare if the LEFT term is Bigger than or equal to the RIGHT term
<= compare if the LEFT term is Less than or equal to the RIGHT term
> compare if the LEFT term is Bigger than the RIGHT term
< compare if the LEFT term is Less than the RIGHT term
== compare if the LEFT term is equal to the RIGHT term
!= compare if the LEFT term is NOT EQUAL to the RIGHT term
So in regards to why we would use them; well whenever we need to check if two terms are numerically the same (Equal too) or similar or even not equal we can use the appropriate operator to do the comparison for us which will then return a boolean result of TRUE(1) or FALSE(0).. back to us.
PlayBasic Tutorial: Into to IF / Then and IF / ENDIF statements ( 2017/03/21)
This #tutorial walks the new coder through the IF / THEN and IF / ENDIF statement pairs which are used to selectively execute sections of the code, based upon the result of the comparison operators. IF statements actually allow changes in execution control, so they act upon the comparison, but it's just easier to think of them as part of the comparisons landscape when learning programming.
Setfps20DoClsrgb(20,30,40);
Mx =MouseX()
My =MouseY()Circle Mx,My,40,trueprint Mx
print My
box500,300,600,400,falseif(Mx >500)and(Mx <600)and My >300and My<400print"Mouse is within zone"endifSyncloop