minus-squareluluu@lemmy.worldtoAsk Lemmy@lemmy.world•In how many languages can you count to 10?linkfedilinkarrow-up25·7 hours ago1. Python for i in range(11): print(i) 2. R for (i in 0:10) { print(i) } 3. C/C++ #include <iostream> int main() { for (int i = 0; i <= 10; ++i) { std::cout << i << std::endl; } return 0; } 4. Java public class CountToTen { public static void main(String[] args) { for (int i = 0; i <= 10; i++) { System.out.println(i); } } } 5. Lua for i = 0, 10 do print(i) end 6. Bash (Shell Script) for i in $(seq 0 10); do echo $i done 7. Batch (Windows Command Script) @echo off for /l %%i in (0,1,10) do ( echo %%i ) 8. Go package main import "fmt" func main() { for i := 0; i <= 10; i++ { fmt.Println(i) } } 9. Rust fn main() { for i in 0..=10 { // 0..=10 includes 10 println!("{}", i); } } 10. Zig const std = @import("std"); pub fn main() !void { var i: i32 = 0; while (i <= 10) { std.debug.print("{}\n", .{i}); i += 1; } } 11. Scala for (i <- 0 to 10) { println(i) } 12. Fortran program count_to_ten implicit none integer :: i do i = 0, 10 print *, i end do end program count_to_ten 13. Haskell main :: IO () main = mapM_ print [0..10] 14. Julia for i in 0:10 println(i) end linkfedilink
minus-squareluluu@lemmy.worldtoAsk Lemmy@lemmy.world•*HOW* can we coax search-engines in to being able to do the simple "lemmy" + "search word" thing..?linkfedilinkarrow-up2·25 days agoYou mean that zeppelin was high in the clouds and motorhead are oil heads? linkfedilink
luluu@lemmy.world to Spiders@lemmy.world · edit-28 months agoA beautiful Orb Weaverplus-squarelemmy.worldimagemessage-square0fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageA beautiful Orb Weaverplus-squarelemmy.worldluluu@lemmy.world to Spiders@lemmy.world · edit-28 months agomessage-square0fedilink
1. Python
for i in range(11): print(i)
2. R
3. C/C++
4. Java
public class CountToTen { public static void main(String[] args) { for (int i = 0; i <= 10; i++) { System.out.println(i); } } }
5. Lua
for i = 0, 10 do print(i) end
6. Bash (Shell Script)
for i in $(seq 0 10); do echo $i done
7. Batch (Windows Command Script)
8. Go
package main import "fmt" func main() { for i := 0; i <= 10; i++ { fmt.Println(i) } }
9. Rust
fn main() { for i in 0..=10 { // 0..=10 includes 10 println!("{}", i); } }
10. Zig
11. Scala
12. Fortran
13. Haskell
14. Julia