你真的懂得怎么写代码吗?

你们肯定有些人学过代码,比如说Java,Python,C++等(Scratch这个东东就不配进来)

但是你们真的懂得怎么写代码吗?

Groovy语言输出Sum of x + y = 35是这样的

def x = 10
def y = 25

print 'Sum of x + y = ' + (x + y)

Assembly语言输出Hello,World!是这样的

section .data
	hello:     db 'Hello world!',10    ; 'Hello world!' plus a linefeed character
	helloLen:  equ $-hello             ; Length of the 'Hello world!' string

section .text
	global _start

_start:
	mov eax,4            ; The system call for write (sys_write)
	mov ebx,1            ; File descriptor 1 - standard output
	mov ecx,hello        ; Put the offset of hello in ecx
	mov edx,helloLen     ; helloLen is a constant, so we don't need to say
	                     ;  mov edx,[helloLen] to get it's actual value
	int 80h              ; Call the kernel
	mov eax,1            ; The system call for exit (sys_exit)
	mov ebx,0            ; Exit with return "code" of 0 (no error)
	int 80h;

(说实话,是真的很复杂,还不如C++呢)

R语言输出Hello,World!是这样的

myString <- "Hello, World!"

print ( myString)

是不是很简单

VB.NET输出Hello,World!是这样的

Module Module1

    Sub Main()
        Console.WriteLine("Hello World!")
    End Sub

End Module

TybeScirpt就更简单了

const hello : string = "Hello World!"
console.log(hello)

Kotlin是这样的

fun main(args : Array<String>){
    println("Hello World!")
}

Pascal是这样的

program Hello;
begin
  writeln ('Hello, world!')
end.

很无语这个代码段都没有兼容的

下面有请最简单的代码语言Lua出场!

print("Hello World!")

是不是很惊讶,就这么简单

然后是Node.js语言输出Hello,World!是这样的,也是一样简单

console.log("Hello World!");

Go语言输出Hello,World!是这样的!

package main

import "fmt"

func main() {
   fmt.Println("Hello, World!")
}

Swift语言是这样的

/* Write swift code in this online editor and run it. */
var myString = "Hello, World!"

print(myString)

RUST语言是这样的

fn main() {
    println!("Hello World!");
}

Bash语言是这样的

#!/bin/bash
echo 'Hello World!'

Perl语言是这样的

#!/usr/bin/perl
		
print "Hello, World!\n";

Erlang语言是这样的

% escript will ignore the first line

main(_) ->
    io:format("Hello World!~n").

Scala语言是这样的

object Main {
  def main(args:Array[String])
  {
    println("Hello World!")
  }	
}

C#语言是这样的

using System;
namespace HelloWorldApplication
{
   class HelloWorld
   {
      static void Main(string[] args)
      {
         /* Write C# code in this online editor and run it. */
         Console.WriteLine("Hello World!");
         Console.ReadKey();
      }
   }
}

Ruby语言是这样的

#!/usr/bin/ruby
# -*- coding: UTF-8 -*-

puts "Hello World!";

感情这个也不支持

C++语言是这样的

#include <iostream>
using namespace std;

int main()
{
   cout << "Hello World";
   return 0;
}
#include <cstdio>
using namespace std;

int main()
{
   printf("Hello,World!");
   return 0;
}

C语言是这样的

#include <stdio.h>

int main()
{
   /*  Write C code in this online editor and run it. */
   printf("Hello, World! \n");
   
   return 0;
}

Java语言是这样的

public class HelloWorld {
    public static void main(String []args) {
       System.out.println("Hello World!");
    }
}

Python语言是这样的

Python3:

#!/usr/bin/python
# Write Python 3 code in this online editor and run it.
print("Hello, World!");

Python2:

# -*- coding: UTF-8 -*-
# Write Python 2 code in this online editor and run it.
print 'Hello World!'

PHP语言是这样的

<?php
echo 'Hello World!';
?>

现在你们再问一下自己,这些自己都会吗,而且会灵活运用吗

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值