User:Guest-1052/coding: Difference between revisions
Appearance
Guest-1052 (talk | contribs) Created page with "Oh, hello there.<br> I made this page just to share my code. And document me coding in programming languages like assembly.<br> PS: Im horrible at Assembly, but i will try and learn more of it, because its really fun.<br> I also might document some newer coding news like how WebGPU is better than WebGL and how fast it is.<br> And how ChatGPT isnt the best programmer. == Code == Hmmm... <syntaxhighlight lang="java"> class Main{ public static void main(String args[]){..." |
Guest-1052 (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
It has been released... MILK.JS. DO BUYMILK()! | |||
<syntaxhighlight lang="js"> | |||
buymilk= function() | |||
{ | |||
milk={ | |||
drink:_=>{console.log("slurp slurp");if(milk.spoiled==true){console.log("dies")} delete milk}, | |||
throwaway: _=>{delete milk}, | |||
spoil:_=>{milk.spoiled=true}, | |||
check:_=>{if(milk.spoiled==true){console.log("Your milk isnt spoiled")} else{console.log("Your milk is spoiled :(")}}, | |||
spoiled: false | |||
}; | |||
setTimeout(_=>{milk.spoiled=true},50500) } | |||
</syntaxhighlight> | |||
Java but Javascript!! ! ! ! !! ! ! !! ! ! ! ! ! ! | |||
<syntaxhighlight lang="js"> | |||
"use strict"; | |||
/* | |||
This is how you can make Javascript look more like Java: | |||
1. use CamelCase for naming variables instead of snake_case | |||
2. Use curly brackets to define blocks of code, even if they contain only one statement | |||
3. Use semicolons to terminate statements | |||
4. use doubles quotes instead of single quotes for strings | |||
5. use strict mode | |||
6. make the code into one big function called main() | |||
*/ | |||
function main(){ | |||
window.w.chat.send("Im using this more java looking javascript syntax to send this message"); | |||
}; | |||
main() | |||
</syntaxhighlight> | </syntaxhighlight> |