about | help | code help+videos | done | prefs |
naturals
Define a function that when passed an integer (say n), returns an array containing the numbers 1, 2, ..., n in that order. Return an empty array if n <= 0. naturals(0) → [] naturals(-5) → [] naturals(8) → [1, 2, 3, 4, 5, 6, 7, 8] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 3 Post-solution available
Copyright Nick Parlante 2017 - privacy