add element to another list with foreach scala

    0

    0

    The output of this code is "rabindra Rabindranath Tagore".

    var a = "rabindra"
    var b = ""
    var c = ""
    
    a.foreach( x => { b = b +x})
    a.reverseIterator.foreach( x => { c = c.appended(x)})
    
    println(b)
    println(c)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.