SGN will convert any number into 1, 0 or -1. I'm using SB3 and SB3 doesn't have CONST... There's a Japanese official beginner guide for SB1/SB2. SB1 version(official): https://smileboom.com/special/petitcom/konnichiwa.html SB2 version(official): https://smileboom.com/special/ptcm2/co_konnichiwa/p01.php SB3 version(unofficial): http://wiki.hosiken.jp/petc3gou/?Beginner%2FChapter1 I think the official reference is also useful to learn commands. Japanese: https://sup4.smilebasic.com/doku.php?id=reference:top English: https://sup4.smilebasic.com/en/doku.php?id=reference:topSGN checks if a number is greater or less than 0So instead of IF A == 0 THEN XYZ, it'll be "SGN(A) = XYZ"??? or it will convert any number into 1 or 0 or -1 Also, give me more examples on CONST?SGN(100) -> 1 SGN(0) -> 0 SGN(-5) -> -1CONST is faster than using a variable (it's the same speed as using a number directly)CONST #SIZE = 8 * 2 VAR SIZE = 8 * 2 X = X + SIZE 'slower 'These are the same speed: X = X + 16 X = X + 8*2 X = X + #SIZE
DocWaluigean's Extremely Annoying Millions of Questions
Root / Programming Questions / [.]
DocWaluigeanCreated:
SGN checks if a number is greater or less than 0So instead of IF A == 0 THEN XYZ, it'll be "SGN(A) = XYZ"??? or it will convert any number into 1 or 0 or -1 Also, give me more examples on CONST?SGN(100) -> 1 SGN(0) -> 0 SGN(-5) -> -1CONST is faster than using a variable (it's the same speed as using a number directly)CONST #SIZE = 8 * 2 VAR SIZE = 8 * 2 X = X + SIZE 'slower 'These are the same speed: X = X + 16 X = X + 8*2 X = X + #SIZE
So if I did "SGN(BOB)" which bob has 9001, it will be converted to 1? That's it?
I see.
Thanks for the guide, but it's not enough for me: I get too sensitive with the way they explain and I get confused easily. It's why I have to ask many questions for clarification.