Author Topic: Programming Megathread  (Read 143896 times)

I "know" (dependent on how much of a butt you are) 4 coding languages (listed on how much I know them)
Torque:
Code: [Select]
function whatever(%stupid)
{
      %stupid = 5;
      if (%stupid == 5)
      {
            echo("im good at coding");
      }
}
whatever();
Code: [Select]
LUA
local a = 10
if a == 10 then
     print('I suck at coding')
specifically roblox lua.
Code: [Select]

while true do
     game.Workspace.base.BrickColor = BrickColor.Red()
     wait(0.1)
     game.Workspace.base.BrickColor = BrickColor.Blue()
     wait(0.1)
     game.Workspace.base.BrickColor = BrickColor.Green()
     wait(0.1)
     game.Workspace.base.BrickColor = BrickColor.Black()
     wait(0.1)
     game.Workspace.base.BrickColor = BrickColor.Yellow()
end

python:
Code: [Select]
print('butts are' %s) % stupid
poopiscrap = 5
print('i like' poopiscrap)
I haven't really done python in a while, so....


Java:
Code: [Select]
int x = 10
int y = 10
System.out.printIn(x "is also" y)
Again, I haven't done Java in a LONG time.
« Last Edit: December 13, 2015, 04:38:38 PM by Bow »

python:
Code: [Select]
print('butts are' %s) % stupid
poopiscrap = 5
print('i like' poopiscrap)
I haven't really done python in a while, so....


Java:
Code: [Select]
int x = 10
int y = 10
System.out.printIn(x "is also" y)
Again, I haven't done Java in a LONG time.
neither of these will work

in python, string interpolation like that, with a %, isn't really used. even if it was, that's still not a valid way to do it
instead, you'd need to write print('butts are {0}'.format(stupid)) and that of course assumes that stupid is a real variable

the java one won't work because java requires a class with a main method. you'd have to write this instead:

public class Whatever {
    static void main(String[] args) {
        int x = 10;
        int y = 10;
        System.out.println(x + " is also " + y);
    }
}


I don't think the stuff you had in the println call would work either, but I don't have compiler on hand to check. it probably wouldn't though
also you have to have semicolons
« Last Edit: December 14, 2015, 09:16:07 PM by Foxscotch »

I think programming is lame unless it is interacting with something in the physical world.

I get ads sometimes on Facebook to apply to become an advertisement software engineer for AOL accompanied by a video with employees talking about how great it is to work there. It annoys me because I wonder what kind of tool aspires to use their skills to support a machine to bother end users and stuff executive pockets, especially for an "off brand" company like AOL.

I just looked it up and apparently AOL was bought by Verizion this past summer. That reminds me of how one of my friends from university got an engineering job with Verizon when he graduated and immediately started guzzling that corporate kool aid. Sharing stories about captains of industry, how poor people suck, defending anti-net neutrality laws, and other similar things.

public class Whatever {
    static void main(String[] args) {
        int x = 10;
        int y = 10;
        System.out.println(x + ' is also ' + y);
    }
}


java string literals are surrounded in ", not '. character literals are surrounded with ', but otherwise yeah this is right

i've never really worked extensively with java, but will that code not throw an error because you're trying to concatenate an int with a string? or is that just implied in java?

i've never really worked extensively with java, but will that code not throw an error because you're trying to concatenate an int with a string? or is that just implied in java?
no, i'm pretty sure it just works. if you do get an error, then System.out.println("" + x + " is also " + y); would definitely work.

java string literals are surrounded in ", not '. character literals are surrounded with ', but otherwise yeah this is right
oops, right. that's something I forget a lot, cus I think single quotes are way more attractive, so I use them in python almost exclusively
i've never really worked extensively with java, but will that code not throw an error because you're trying to concatenate an int with a string? or is that just implied in java?
I do know that works though. which actually feels kinda backwards, because it doesn't work in python

just got 10 keys for this old inferior language at work... one of the many languages we code in lol


simple af
Code: [Select]
? "Hello world"




cool "advent calendar" with coding problems for every day

http://adventofcode.com/

cool "advent calendar" with coding problems for every day
http://adventofcode.com/
I started the first one and I was wondering how it was related to programming until I saw the input lol

I started the first one and I was wondering how it was related to programming until I saw the input lol

it's really fun, though

as a beginner to programming, i'm on #3

for those wishing to compile small java examples, I use www.compilejava.net at work because easy

also happens to be written by one of my friends