Un cours pour se lancer dans la programmation avec le langage Go (golang).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
583 B

  1. package main
  2. import "fmt"
  3. func main() {
  4. for i := 0; i < 5; i++ {
  5. fmt.Println(i)
  6. }
  7. for i := 0; ; {
  8. if i >= 5 {
  9. break
  10. }
  11. fmt.Println(i)
  12. i++
  13. }
  14. i := 0
  15. for i < 5 {
  16. fmt.Println(i)
  17. i++
  18. }
  19. i = 0
  20. for ; ; i++ {
  21. if i >= 5 {
  22. break
  23. }
  24. fmt.Println(i)
  25. }
  26. for i := 0; i < 5; {
  27. fmt.Println(i)
  28. i++
  29. }
  30. i = 0
  31. for ; i < 5; i++ {
  32. fmt.Println(i)
  33. }
  34. for i := 0; ; i++ {
  35. if i >= 5 {
  36. break
  37. }
  38. fmt.Println(i)
  39. }
  40. i = 0
  41. for {
  42. if i >= 5 {
  43. break
  44. }
  45. fmt.Println(i)
  46. i++
  47. }
  48. for i, j := 0, 10; i != j; i, j = i+1, j-1 {
  49. fmt.Println(i, j)
  50. }
  51. }