**编程语言学习第一步:记录是最好的学习方法。
不同语言实现同一效果的语法及对比。
编辑器为VScode,代码运行为插件Code Runner,运行时间仅供参考。
该文仅用于备忘。**
1.c
#include <stdio.h>
int main(){
printf("Hello,World!");
return 0;
}
Hello,World!
[Done] exited with code=0 in 1.477 seconds
2.php
<?php
echo "Hello,World!";
?>
Hello,World!
[Done] exited with code=0 in 0.076 seconds
3.go
package main
import "fmt"
func main() {
fmt.Println("Hello,World!")
}
Hello,World!
[Done] exited with code=0 in 0.752 seconds
4.js
console.log('Hello,World!');
Hello,World!
[Done] exited with code=0 in 0.139 seconds
5.ts
同上;
6.java
// 文件名与类名须一致
public class hello {
public static void main(String[] args) {
System.out.println("Hello,World!");
}
}
Hello,World!
[Done] exited with code=0 in 1.281 seconds
7.python
# -*- coding: utf-8 -*-
print("Hello,World!")
Hello,World!
[Done] exited with code=0 in 0.068 seconds
网友评论