|
| 23 Dec 2013 10:17 AM |
$age = 17;
if ($age > 16) { echo "You can drive!"; }
var age = 17;
if (age > 16) { HORROR STORIES >> document.write "You can drive!"; }
age = 17;
if age > 16 then print ("You can drive!"); end
I'm noticing a pattern. |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 10:22 AM |
I know a bit of JavaScript, use to know Lua, but I am more better in Objective C.
In Objective C it would go like this int age = 17
if (age > 16) { NSLog(@"You can drive"); }
This may compile with error cause I sorta just ate and I am like sleepy, but you know lots of languages you can see patterns. |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 10:25 AM |
| @Ultra, be my Obj-C friend. |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 23 Dec 2013 10:40 AM |
Why the semicolons in Lua? print("no semicolons here kk") |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Dec 2013 11:06 AM |
Age := 17 if Age <= 16 { fmt.Println("You can't drive! Are you crazy?") } |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 11:31 AM |
@Mettasaur, I use semicolons so there isn't and ambiguity in my code: ---- Ex:
print("HI!")
(Something else here that isn't a statement or assignment) ---- ,results in ambiguity. The parser thinks that you are trying to do: print("Hi!")(Something Else Here); [passing arguments to a returned function {like in RBXUtil's Create''{} function}]
Instead, if you used semi-colons: ---- print("Hi!");
(Something else here); ---- ,it wouldn't error because it now knows that they are both separate statements unto themselves.
Everybody is happy now!!! |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 23 Dec 2013 11:41 AM |
| I just tried putting a semicolon between a print call and a line that wasn't a statement or assignment and it still errored "attempt to call nil value". I don't think semi colons do much really other than split up statements surefire and make the code look ugly with out of place semicolons. |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 11:43 AM |
I'm going to quote Oysi here:
""" You have to use semicolons right there, because Lua didn't know what to do, and just called it ambiguous syntax.
Look, when you try to call a function like this:
f ()
it says ambiguous syntax. Which is what Lua thought you MIGHT want to do. Look:
(function() print("Test0") end)()(function() print("Test1") end)()
I just removed those enters, and it turned like that. A tailcall, if you will. Which is fully possible, and you could make it return functions to not error.
Notice how there are two possible inputs. One where you call two anonymous functions, and the other where you tailcall. Lua can't know which one to choose, because lua doesn't want to be wrong. Therefore lua just calls it ambiguous syntax, and makes you add those semicolons. """ From this thread: http://www.roblox.com/Forum/ShowPost.aspx?PostID=48670685 |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 23 Dec 2013 11:53 AM |
| I stated that I know it forces a new statement, so I know why that is happening, but I don't get why exactly one would even need to put two tail calls in the first place when what is done in both can be done in just one. Also, semicolons still look out of place in Lua when used frivolously. |
|
|
| Report Abuse |
|
|
| |
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 Dec 2013 12:02 PM |
+++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ . > + . +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ . ----- - . ----- --- . > + . > . |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 12:11 PM |
Is that Brainfck?
It sure looks like it. I've always wonted to learn how to program in it. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 Dec 2013 01:11 PM |
yes it is
Don't ask me how I know what it does.
It prints 'Hello world\n' (where \n is actually the \n character) |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 01:16 PM |
| It's basically the same as assembly, but it just adds or removes a bit from the stack, or shuffles it around. It is a very minimalist approach towards ASM. [It MIGHT be useful if they have a very limited amount of keys on their keyboard]. |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2013 05:14 PM |
That isn't what assembly does. In fact, it is not even basically the same as assembl(y|er).
Brain_ is just an annoying way to give instructions to a computer, it is minimalist, but inefficient. Subleq-based code would be more efficient, and take less time to program in. |
|
|
| Report Abuse |
|
|