KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:16 PM |
Keywords I can get confused on
Keywords:
else elseif break local function
(No one post just yet, im writing out examples for each and everyone)
|
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:20 PM |
if script.Parent.BrickColor = BrickColor.new ("Bright blue") elseif if script.Parent.BrickColor = BrickColor.new ("Bright green")
Is this a correct demonstartion on elseif?
Else:
if script.Parent.BrickColor = BrickColor.new ("Bright blue") else script.Parent.BrickColor = BrickColor.new ("Bright red")
Is this correct?? |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:23 PM |
You forgot the thens, and else and elseif are used incorrectly.
You also forgot the ends. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:25 PM |
Example of a correct one please? Thanks! |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:26 PM |
| I tried these for other scripts, and I cant seem to use em' right. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:28 PM |
Why do you keep doing a space before ("color") if script.Parent.BrickColor == BrickColor.new("Bright blue") then print('hi') elseif script.Parent.BrickColor = BrickColor.new("Bright green") then print('hi') end
if script.Parent.BrickColor = BrickColor.new("Bright blue") then print('hi') else script.Parent.BrickColor = BrickColor.new("Bright red") end |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:29 PM |
if checks == true then -- yay elseif checks == "lol" then -- lel else -- stuff end |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:36 PM |
Thanks Guys!
specifically bob |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:37 PM |
Hold on i messed up if script.Parent.BrickColor == BrickColor.new("Bright blue") then print('hi') elseif script.Parent.BrickColor == BrickColor.new("Bright green") then print('hi') end
if script.Parent.BrickColor == BrickColor.new("Bright blue") then print('hi') else script.Parent.BrickColor == BrickColor.new("Bright red") end |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:38 PM |
Question:
if script.Parent.BrickColor == BrickColor.new("Bright blue") then print('hi') elseif script.Parent.BrickColor == BrickColor.new("Bright green") then print('hi') end
if script.Parent.BrickColor == BrickColor.new("Bright blue") then print('hi') else script.Parent.BrickColor = BrickColor.new("Bright red") end
when using if, dont I check using ==? Also using elseif? I fixed it in this one. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:39 PM |
| I dunno about else though. Do i use ==? |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 10:41 PM |
Ok i see your post. Still one question. I thought only in 'if' you used "==" but in else you put it. this question I need just a yes or no. Do you put "==" in else? |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:43 PM |
Yes everywhere in a if statement you use == to see if it's equal to and ~= to see if it isn't equal to >= to see if it's greater than something (num values only) <= to see if something is lower than something(num values only) |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:52 PM |
You got if's and elseif's right. Now for else's.
if part.BrickColor == BrickColor.new("Bright red") then print("Brick is red") else print("Brick is not red") end |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 10:53 PM |
Now for break
x = true function change() x = false end
while true do wait(0.1) change() if x = false then break end end |
|
|
| Report Abuse |
|
|
| |
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 11:09 PM |
SO Basically saying "break" means ending the loop in an if, elseif, else, etc?
instead of this:
if script.Parent.BrickColor == BrickColor.new("Bright blue") then end
You would say this?
if script.Parent.BrickColor == BrickColor.new("Bright blue") then break |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 11:13 PM |
| Thanks! I think thats right! |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 24 Oct 2013 11:14 PM |
Else just means "something else than above" right? Thanks. 3 keywords now are: UNDERSTOOD! |
|
|
| Report Abuse |
|
|