# I am getting error while running simple code

**URL:** <https://discourse.julialang.org/t/i-am-getting-error-while-running-simple-code/83166>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 22, 2022, 8:19am UTC](https://discourse.julialang.org/t/i-am-getting-error-while-running-simple-code/83166 "2022-06-22T08:19:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raamsa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raamsa/32/33488_2.png) [@raamsa](https://discourse.julialang.org/u/raamsa)\
**Post date:** [June 22, 2022, 8:19am UTC](https://discourse.julialang.org/t/i-am-getting-error-while-running-simple-code/83166/1 "2022-06-22T08:19:58Z")

</div>

I have started to learn Julia. And I made a simple program using the function to find the area of the square. The code is below

```julia
# Given the length of square
function areaOfsquare()
    global s= input("Enter the length of side: ")
    a = s*s
    print("\n Area of square is $a")
end 

areaOfsquare()

```

Error:  
UndefVarError: input not defined

Stacktrace:  
[1] areaOfsquare()  
@ Main .\In[12]:3  
[2] top-level scope  
@ In[12]:8  
[3] eval  
@ .\boot.jl:373 [inlined]  
[4] include\_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)  
@ Base .\loading.jl:1196

I tried global before the variable s but still getting the same error.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [June 22, 2022, 8:28am UTC](https://discourse.julialang.org/t/i-am-getting-error-while-running-simple-code/83166/2 "2022-06-22T08:28:24Z")

</div>

Hi! I don’t think there’s an `input()` function. (Perhaps Python has one?)

Something like this might work:

```julia
function areaOfsquare()
    print("Enter the length of side: \n")
    s = parse(Float64, readline())
    a = s * s
    print("\n Area of square is $a")
end 

```

---

<div class="post-metadata">

**Author:** ![raamsa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raamsa/32/33488_2.png) [@raamsa](https://discourse.julialang.org/u/raamsa)\
**Post date:** [June 22, 2022, 8:39am UTC](https://discourse.julialang.org/t/i-am-getting-error-while-running-simple-code/83166/3 "2022-06-22T08:39:29Z")

</div>

Thank you so much for your reply. It works.
