-
Client Software Programmer
Tutorial on Functions "bare-bones" for super duper newbies who just don't get it.
Hi, functions sound scary but once learned, can be very easy, they are also very useful and if you learn them you will get a hot girl!
First of all, to declare a function, just type:
second of all, you have to name the function, I will name my function tracer, like this:
PHP Code:
function tracer(){
now that we have written the function, and declared its name, its time to give it something to do, you can make it do anything, but I choose to make it trace a word in the output so it will look like this...
PHP Code:
function tracer(){
trace("hey dude I wrote my first function");
}
now, thats all there is too it! you're done! now go show a hot girl what you did, you bad ass.
Hope you newbies enjoyed the tutorial, what are you waiting for go show your girlfriend some of your skillz and trace her to your bed
-
Prid - Outing
Woah, didn't know you were doing tutorials You might wanna get this post sticky or make it easily accessible from somewhere, 'cause it's great (y)
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Client Software Programmer
I don't know how to sticky it I think only mods can do that, but thanks @nig13
-
Senior Member
This tutorial is missing the key point, namely, why would anyone need them functions. To show that you could e g offer this code:
PHP Code:
tracer(); tracer(); tracer();
And explain that this shows the message three times. An alternative would be to write
PHP Code:
trace("hey dude I wrote my first function"); trace("hey dude I wrote my first function"); trace("hey dude I wrote my first function");
Which is obviously less compact.
TBH, this is not really good example, since "trace" itself looks pretty much like a function.
-
Client Software Programmer
-
Client Software Programmer
trace this in your outputs guys
PHP Code:
t = "a",x = "r",tvfd = "c",b = "e",bbfd = "m",rf = "l",bn = "c",tbd = "k",l = "a"
te = "_",tr = "k",ed = "s",tfv = "u",y = 50;
function vc(){
trace(b);
}function bta(){
trace(x);
}function fds(){
trace(te);
}function bbfdm(){
trace(bbfd);
}function tbs(){
trace(t);
}function txkg(){
trace(rf);
}function mvfd(){
trace(tr);
}function heh(){
trace(tfv);
}function xyz(){
trace(t);
}function jx(){
trace(bn);
}function edf(){
trace(ed);
}
edf(mvfd(jx(heh(edf(fds(jx(mvfd(xyz(bbfdm(txkg(tbs(vc(bta())))))))))))));
-
.
Hi,
That is a pretty ugly set of functions Alloy, I do believe you just declared some sort of war against your buddy realMakc.
t = "a",x = "r",tvfd = "c",b = "e",bbfd = "m",rf = "l",bn = "c",tbd = "k",l = "a"
te = "_",tr = "k",ed = "s",tfv = "u",y = 50;
function vc(){
trace(b);
}function bta(){
trace(x);
}function fds(){
trace(te);
}function bbfdm(){
trace(bbfd);
}function tbs(){
trace(t);
}function txkg(){
trace(rf);
}function mvfd(){
trace(tr);
}function heh(){
trace(tfv);
}function xyz(){
trace(t);
}function jx(){
trace(bn);
}function edf(){
trace(ed);
}
edf(mvfd(jx(heh(edf(fds(jx(mvfd(xyz(bbfdm(txkg(tbs (vc(bta())))))))))))));
I still think you could have made it look nicer using an array and a loop with one function to trace out the same.
Heres a kind of basic useful function (looks harder than it is);
PHP Code:
var today:Date = new Date(); var days:Array = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); var months:Array = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var currentDay:String = days[today.getDay()]; var currentMonth:String = months[today.getMonth()]; var currentDate:Number = today.getDate(); var currentYear:Number = today.getFullYear();
function addSuffix():String { if (currentDate == 1 || currentDate == 21 || currentDate == 31) { return "st"; } else if (currentDate == 2 || currentDate == 22) { return "nd"; } else if (currentDate == 3 || currentDate == 23) { return "rd"; } else { return "th"; } }
this.createTextField("theDate",1,1,1,1,1);
var dateFormat:TextFormat = new TextFormat(); dateFormat.font = "Arial"; dateFormat.size = 14; dateFormat.color = 0x000000;
theDate.autoSize = true; theDate.text = currentDay + " - " + today.getDate() + addSuffix() + " " + currentMonth + " " + currentYear; theDate.setTextFormat(dateFormat);
addSuffix() is the key part, it appends the date suffix to the day, it can also be called slightly differently too.
Last edited by fruitbeard; 02-16-2015 at 02:31 AM.
-
Client Software Programmer
The goal was just to obfuscate what it would really say before run time I can care less about writing quality code for that kid hopefully his pc crashes with my bloated skript
-
Senior Member
oh well,
PHP Code:
alert(/..../.exec((0/0+[])[-1>>>-1]+(f='lol')[~~{}]+f)[~~[][{}]]+(g=1/0+[])[g.length-1]+(~f+{})[~~{}]+'хуй')
-
Client Software Programmer
-
Senior Member
of course it does, it's just you could not figure out how to do it.
-
Client Software Programmer
thats not my job, you should have had it ready just like me
-
Senior Member
sorry that I have overestimated your 'ready' level, I really should have figured it from your tutorial above.
-
.
Hi,
Nothing personal here, but I don't think Americans in general like being told that something is not very good, whereas in europe people tend to accept that something is not so good a lot easier and more humbly.
I can't see a problem with telling somebody that something is not so good (or being told myself), why fool them into thinking it is good when it simply is not.
-
Client Software Programmer
I live in Africa man.
-written via OLPC
-
Senior Member
and he said "good call" which I thought means "thanks", but apparently it means "ffff you"
-
Client Software Programmer
nah I love you guys im j/k
-
Prid - Outing
Wut on earth xD? Well this escalated quickly -- from just being a tutorial to I don't know what Chill out, guys, this forum is for helping others, lol
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|